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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Steel.ST.Array.Swap.fst | Steel.ST.Array.Swap.array_index | val array_index (#t: Type) (a: array t) : Tot (Gen.array_index_t (array_pts_to a)) | val array_index (#t: Type) (a: array t) : Tot (Gen.array_index_t (array_pts_to a)) | let array_index
(#t: Type)
(a: array t)
: Tot (Gen.array_index_t (array_pts_to a))
= fun s n i ->
index a i | {
"file_name": "lib/steel/Steel.ST.Array.Swap.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 17,
"start_col": 0,
"start_line": 12
} | module Steel.ST.Array.Swap
open Steel.ST.GenElim
open Steel.ST.Array // for pts_to
module Gen = Steel.ST.GenArraySwap
[@@__reduce__]
let array_pts_to (#t: Type) (a: array t) : Tot (Gen.array_pts_to_t t) =
fun s -> pts_to a full_perm (Ghost.reveal s) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.fsti.checked",
"Steel.ST.Array.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Array.Swap.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.ST.Array // for pts_to",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap",
"short_module": "Gen"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": 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: Steel.ST.Array.array t
-> Steel.ST.GenArraySwap.array_index_t (Steel.ST.Array.Swap.array_pts_to a) | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Array.array",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"FStar.SizeT.t",
"Steel.ST.Array.index",
"Steel.FractionalPermission.full_perm",
"Steel.ST.GenArraySwap.array_index_t",
"Steel.ST.Array.Swap.array_pts_to"
] | [] | false | false | false | false | false | let array_index (#t: Type) (a: array t) : Tot (Gen.array_index_t (array_pts_to a)) =
| fun s n i -> index a i | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_tm_opt | val eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) } | val eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) } | let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 22,
"end_line": 98,
"start_col": 0,
"start_line": 96
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 |
t1: FStar.Pervasives.Native.option Pulse.Syntax.Base.term ->
t2: FStar.Pervasives.Native.option Pulse.Syntax.Base.term
-> b: Prims.bool{b <==> t1 == t2} | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.eq_opt",
"Pulse.Syntax.Base.eq_tm",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_tm_opt (t1 t2: option term) : b: bool{b <==> (t1 == t2)} =
| eq_opt eq_tm t1 t2 | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_comp_opt | val eq_comp_opt (c1 c2: option comp) : b: bool{b <==> (c1 == c2)} | val eq_comp_opt (c1 c2: option comp) : b: bool{b <==> (c1 == c2)} | let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 102,
"start_col": 0,
"start_line": 100
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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: FStar.Pervasives.Native.option Pulse.Syntax.Base.comp ->
c2: FStar.Pervasives.Native.option Pulse.Syntax.Base.comp
-> b: Prims.bool{b <==> c1 == c2} | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.comp",
"Pulse.Syntax.Base.eq_opt",
"Pulse.Syntax.Base.eq_comp",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_comp_opt (c1 c2: option comp) : b: bool{b <==> (c1 == c2)} =
| eq_opt eq_comp c1 c2 | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_tm_list | val eq_tm_list (t1 t2:list term)
: b:bool { b <==> (t1 == t2) } | val eq_tm_list (t1 t2:list term)
: b:bool { b <==> (t1 == t2) } | let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 54,
"end_line": 119,
"start_col": 0,
"start_line": 119
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | t1: Prims.list Pulse.Syntax.Base.term -> t2: Prims.list Pulse.Syntax.Base.term
-> b: Prims.bool{b <==> t1 == t2} | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.eq_list",
"Pulse.Syntax.Base.eq_tm",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_tm_list (t1 t2: list term) =
| eq_list eq_tm t1 t2 | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_comp | val eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) } | val eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) } | let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 16,
"end_line": 78,
"start_col": 0,
"start_line": 65
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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: Pulse.Syntax.Base.comp -> c2: Pulse.Syntax.Base.comp -> b: Prims.bool{b <==> c1 == c2} | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.comp",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.eq_tm",
"Pulse.Syntax.Base.st_comp",
"Pulse.Syntax.Base.eq_st_comp",
"Pulse.Syntax.Base.observability",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_comp (c1 c2: comp) : b: bool{b <==> (c1 == c2)} =
| match c1, c2 with
| C_Tot t1, C_Tot t2 -> eq_tm t1 t2
| C_ST s1, C_ST s2 -> eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 -> eq_tm i1 i2 && o1 = o2 && eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 -> eq_st_comp s1 s2
| _ -> false | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_lemma_AES256EncryptBlock_6way | val va_lemma_AES256EncryptBlock_6way : va_b0:va_code -> va_s0:va_state -> in1:quad32 -> in2:quad32
-> in3:quad32 -> in4:quad32 -> in5:quad32 -> in6:quad32 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptBlock_6way ()) va_s0 /\ va_get_ok va_s0
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ FStar.Seq.Base.length #quad32 round_keys ==
15 /\ round_keys == Vale.AES.AES_BE_s.key_to_round_keys_word AES_256 key /\ va_get_vec 0 va_s0
== in1 /\ va_get_vec 1 va_s0 == in2 /\ va_get_vec 2 va_s0 == in3 /\ va_get_vec 3 va_s0 == in4
/\ va_get_vec 4 va_s0 == in5 /\ va_get_vec 5 va_s0 == in6 /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i < 15 ==>
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer i
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in1 /\ va_get_vec 1 va_sM
== Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in2 /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in3 /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in4 /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in5 /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in6 /\ va_state_eq 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 10 va_sM (va_update_ok va_sM
va_s0))))))))))) | val va_lemma_AES256EncryptBlock_6way : va_b0:va_code -> va_s0:va_state -> in1:quad32 -> in2:quad32
-> in3:quad32 -> in4:quad32 -> in5:quad32 -> in6:quad32 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptBlock_6way ()) va_s0 /\ va_get_ok va_s0
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ FStar.Seq.Base.length #quad32 round_keys ==
15 /\ round_keys == Vale.AES.AES_BE_s.key_to_round_keys_word AES_256 key /\ va_get_vec 0 va_s0
== in1 /\ va_get_vec 1 va_s0 == in2 /\ va_get_vec 2 va_s0 == in3 /\ va_get_vec 3 va_s0 == in4
/\ va_get_vec 4 va_s0 == in5 /\ va_get_vec 5 va_s0 == in6 /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i < 15 ==>
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer i
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in1 /\ va_get_vec 1 va_sM
== Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in2 /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in3 /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in4 /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in5 /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in6 /\ va_state_eq 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 10 va_sM (va_update_ok va_sM
va_s0))))))))))) | let va_lemma_AES256EncryptBlock_6way va_b0 va_s0 in1 in2 in3 in4 in5 in6 key round_keys keys_buffer
=
let (va_mods:va_mods_t) = [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 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptBlock_6way va_mods in1 in2 in3 in4 in5 in6 key round_keys
keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptBlock_6way ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 333 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 363 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 364 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 365 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 2 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 366 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 367 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 4 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 368 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 5 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1359,
"start_col": 0,
"start_line": 1334
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ va_state_eq 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 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) . let
va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 10 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))));
va_lemma_norm_mods ([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 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
let (va_mods:va_mods_t) = [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 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 10 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))));
va_lemma_norm_mods ([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 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM
(va_update_ok va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ())))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptBlock () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1) (va_pbool_and
(va_codegen_success_AES256EncryptRound 2) (va_pbool_and (va_codegen_success_AES256EncryptRound
3) (va_pbool_and (va_codegen_success_AES256EncryptRound 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound 5) (va_pbool_and (va_codegen_success_AES256EncryptRound
6) (va_pbool_and (va_codegen_success_AES256EncryptRound 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound 8) (va_pbool_and (va_codegen_success_AES256EncryptRound
9) (va_pbool_and (va_codegen_success_AES256EncryptRound 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound 11) (va_pbool_and (va_codegen_success_AES256EncryptRound
12) (va_pbool_and (va_codegen_success_AES256EncryptRound 13) (va_pbool_and
(va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptBlock (va_mods:va_mods_t) (input:quad32) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_buffer:buffer128) : (va_quickCode unit
(va_code_AES256EncryptBlock ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 262 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor input (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 1 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 2 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 3 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 4 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 271 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 5 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 6 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 7 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 8 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 9 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 10 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 11 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 12 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 13 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 282 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 286 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.aes_encrypt_word_reveal ()) (va_QEmpty
(())))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptBlock va_b0 va_s0 input key round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptBlock va_mods input key round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptBlock ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 240 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 260 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key input)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptBlock input key round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptBlock (va_code_AES256EncryptBlock ()) va_s0 input key
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM
(va_update_ok va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound_6way
val va_code_AES256EncryptRound_6way : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound_6way n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))
val va_codegen_success_AES256EncryptRound_6way : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound_6way n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound_6way (va_mods:va_mods_t) (n:nat8) (init1:quad32) (init2:quad32)
(init3:quad32) (init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(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 323 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 324 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 325 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 326 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 327 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 328 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 329 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 330 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_QEmpty
(())))))))))))
val va_lemma_AES256EncryptRound_6way : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init1:quad32 ->
init2:quad32 -> init3:quad32 -> init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq
quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound_6way n) va_s0 /\ va_get_ok va_s0 /\
(1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1
va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n /\ va_state_eq 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 10 va_sM (va_update_ok va_sM
va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptRound_6way va_b0 va_s0 n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer =
let (va_mods:va_mods_t) = [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 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound_6way va_mods n init1 init2 init3 init4 init5 init6
round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound_6way n) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 289 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 316 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 2 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 4 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 321 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 5 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec
1 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n /\ (forall (va_x_r10:nat64) (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32)
(va_x_v6:quad32) . let va_sM = va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0
(va_upd_reg 10 va_x_r10 va_s0))))))) in va_get_ok va_sM /\ va_get_vec 0 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound_6way : n:nat8 -> init1:quad32 -> init2:quad32 -> init3:quad32 ->
init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq quad32) -> keys_buffer:buffer128
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5
init6 round_keys keys_buffer va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound_6way n)
([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 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer
va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound_6way (va_code_AES256EncryptRound_6way n) va_s0 n
init1 init2 init3 init4 init5 init6 round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 10 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([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 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128) :
(va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(va_QProc (va_code_AES256EncryptRound_6way n) ([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 10])
(va_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer))
//--
//-- AES256EncryptBlock_6way
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock_6way () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_AES256EncryptRound_6way 1)
(va_CCons (va_code_AES256EncryptRound_6way 2) (va_CCons (va_code_AES256EncryptRound_6way 3)
(va_CCons (va_code_AES256EncryptRound_6way 4) (va_CCons (va_code_AES256EncryptRound_6way 5)
(va_CCons (va_code_AES256EncryptRound_6way 6) (va_CCons (va_code_AES256EncryptRound_6way 7)
(va_CCons (va_code_AES256EncryptRound_6way 8) (va_CCons (va_code_AES256EncryptRound_6way 9)
(va_CCons (va_code_AES256EncryptRound_6way 10) (va_CCons (va_code_AES256EncryptRound_6way 11)
(va_CCons (va_code_AES256EncryptRound_6way 12) (va_CCons (va_code_AES256EncryptRound_6way 13)
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipherlast
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6))
(va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptBlock_6way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_AES256EncryptRound_6way 1)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way 2) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 3) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 5) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 6) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 8) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 9) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 11) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 12) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 13) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipherlast
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (va_ttrue ())))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptBlock_6way (va_mods:va_mods_t) (in1:quad32) (in2:quad32) (in3:quad32)
(in4:quad32) (in5:quad32) (in6:quad32) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptBlock_6way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 370 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init1:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in1 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 371 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init2:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in2 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 372 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init3:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in3 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 373 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init4:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in4 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 374 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init5:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in5 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 375 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.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)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init6:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor in6 (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 377 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 378 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 379 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 380 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 381 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 382 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 383 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 384 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 385 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 1 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 386 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 2 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 387 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 3 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 388 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 4 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 389 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 5 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 390 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 6 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 391 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 7 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 392 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 8 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 393 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 9 init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 394 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 10 init1 init2 init3 init4 init5 init6 round_keys
keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 395 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 11 init1 init2 init3 init4 init5 init6 round_keys
keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 396 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 12 init1 init2 init3 init4 init5 init6 round_keys
keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 397 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound_6way 13 init1 init2 init3 init4 init5 init6 round_keys
keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 398 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 399 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 400 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 401 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 402 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 403 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 404 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.aes_encrypt_word_reveal ()) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.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.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.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.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.InsVector",
"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.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"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.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.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": 20,
"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 ->
in1: Vale.PPC64LE.Memory.quad32 ->
in2: Vale.PPC64LE.Memory.quad32 ->
in3: Vale.PPC64LE.Memory.quad32 ->
in4: Vale.PPC64LE.Memory.quad32 ->
in5: Vale.PPC64LE.Memory.quad32 ->
in6: Vale.PPC64LE.Memory.quad32 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
keys_buffer: Vale.PPC64LE.Memory.buffer128
-> 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.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Memory.buffer128",
"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.AES.PPC64LE.AES256.va_code_AES256EncryptBlock_6way",
"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",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.AES_BE_s.aes_encrypt_word",
"Vale.AES.AES_common_s.AES_256",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.AES.PPC64LE.AES256.va_qcode_AES256EncryptBlock_6way"
] | [] | false | false | false | false | false | let va_lemma_AES256EncryptBlock_6way va_b0 va_s0 in1 in2 in3 in4 in5 in6 key round_keys keys_buffer =
| let va_mods:va_mods_t =
[
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 10;
va_Mod_ok
]
in
let va_qc =
va_qcode_AES256EncryptBlock_6way va_mods in1 in2 in3 in4 in5 in6 key round_keys keys_buffer
in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_AES256EncryptBlock_6way ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 333 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 363 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in1) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 364 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in2) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 365 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 2 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in3) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 366 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in4) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 367 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 4 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in5) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 368 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 5 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key in6))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
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 10;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_opt | val eq_opt (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: option 'a)
: b: bool{b <==> (l == m)} | val eq_opt (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: option 'a)
: b: bool{b <==> (l == m)} | let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 16,
"end_line": 94,
"start_col": 0,
"start_line": 89
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
f: (x: 'a -> y: 'a -> b: Prims.bool{b <==> x == y}) ->
l: FStar.Pervasives.Native.option 'a ->
m: FStar.Pervasives.Native.option 'a
-> b: Prims.bool{b <==> l == m} | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple2"
] | [] | false | false | false | false | false | let eq_opt (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: option 'a)
: b: bool{b <==> (l == m)} =
| match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_st_comp | val eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) } | val eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) } | let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 25,
"end_line": 63,
"start_col": 0,
"start_line": 58
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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: Pulse.Syntax.Base.st_comp -> s2: Pulse.Syntax.Base.st_comp -> b: Prims.bool{b <==> s1 == s2} | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.st_comp",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_univ",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Syntax.Base.eq_tm",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_st_comp (s1 s2: st_comp) : b: bool{b <==> (s1 == s2)} =
| eq_univ s1.u s2.u && eq_tm s1.res s2.res && eq_tm s1.pre s2.pre && eq_tm s1.post s2.post | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_list | val eq_list (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: list 'a)
: b: bool{b <==> (l == m)} | val eq_list (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: list 'a)
: b: bool{b <==> (l == m)} | let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 16,
"end_line": 87,
"start_col": 0,
"start_line": 80
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (x: 'a -> y: 'a -> b: Prims.bool{b <==> x == y}) -> l: Prims.list 'a -> m: Prims.list 'a
-> b: Prims.bool{b <==> l == m} | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2",
"Prims.list",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_list",
"FStar.Pervasives.Native.tuple2"
] | [
"recursion"
] | false | false | false | false | false | let rec eq_list (f: (x: 'a -> y: 'a -> b: bool{b <==> (x == y)})) (l m: list 'a)
: b: bool{b <==> (l == m)} =
| match l, m with
| [], [] -> true
| h1 :: t1, h2 :: t2 -> f h1 h2 && eq_list f t1 t2
| _ -> false | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_binder | val eq_binder (b0 b1: binder) : b: bool{b <==> (b0 == b1)} | val eq_binder (b0 b1: binder) : b: bool{b <==> (b0 == b1)} | let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 117,
"start_col": 0,
"start_line": 116
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b0: Pulse.Syntax.Base.binder -> b1: Pulse.Syntax.Base.binder -> b: Prims.bool{b <==> b0 == b1} | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.binder",
"Pulse.Syntax.Base.eq_tm",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_binder (b0 b1: binder) : b: bool{b <==> (b0 == b1)} =
| eq_tm b0.binder_ty b1.binder_ty | false |
Vale.X64.Decls.fst | Vale.X64.Decls.ins | val ins : Type0 | val ins : Type0 | let ins = BS.ins | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_Semantics_s.ins"
] | [] | false | false | false | true | true | let ins =
| BS.ins | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_pbool_and | val va_pbool_and (x y:va_pbool) : va_pbool | val va_pbool_and (x y:va_pbool) : va_pbool | let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 57,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Vale.X64.Decls.va_pbool -> y: Vale.X64.Decls.va_pbool -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_pbool",
"Vale.Def.PossiblyMonad.op_Amp_Amp_Dot"
] | [] | false | false | false | true | false | let va_pbool_and x y =
| Vale.Def.PossiblyMonad.(( &&. )) x y | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_ffalse | val va_ffalse (reason:string) : va_pbool | val va_ffalse (reason:string) : va_pbool | let va_ffalse = Vale.Def.PossiblyMonad.ffalse | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | reason: Prims.string -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.PossiblyMonad.ffalse"
] | [] | false | false | false | true | false | let va_ffalse =
| Vale.Def.PossiblyMonad.ffalse | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_ttrue | val va_ttrue (_:unit) : va_pbool | val va_ttrue (_:unit) : va_pbool | let va_ttrue () = Vale.Def.PossiblyMonad.ttrue | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.Def.PossiblyMonad.ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_ttrue () =
| Vale.Def.PossiblyMonad.ttrue | false |
Vale.X64.Decls.fst | Vale.X64.Decls.mul_nat_helper | val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) | val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) | let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 44,
"end_line": 40,
"start_col": 0,
"start_line": 39
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Prims.nat -> y: Prims.nat -> FStar.Pervasives.Lemma (ensures x * y >= 0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"FStar.Math.Lemmas.nat_times_nat_is_nat",
"Prims.unit"
] | [] | true | false | true | false | false | let mul_nat_helper x y =
| FStar.Math.Lemmas.nat_times_nat_is_nat x y | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_sub_pat | val eq_sub_pat (pb1 pb2: pattern & bool) : b: bool{b <==> pb1 == pb2} | val eq_sub_pat (pb1 pb2: pattern & bool) : b: bool{b <==> pb1 == pb2} | let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 29,
"end_line": 152,
"start_col": 0,
"start_line": 133
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | pb1: (Pulse.Syntax.Base.pattern * Prims.bool) -> pb2: (Pulse.Syntax.Base.pattern * Prims.bool)
-> b: Prims.bool{b <==> pb1 == pb2} | Prims.Tot | [
"total"
] | [
"eq_pattern",
"eq_sub_pat"
] | [
"FStar.Pervasives.Native.tuple2",
"Pulse.Syntax.Base.pattern",
"Prims.bool",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_pattern",
"Prims.op_Equality",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec eq_sub_pat (pb1 pb2: pattern & bool) : b: bool{b <==> pb1 == pb2} =
| let p1, b1 = pb1 in
let p2, b2 = pb2 in
eq_pattern p1 p2 && b1 = b2 | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_hint_type | val eq_hint_type (ht1 ht2: proof_hint_type) : b: bool{b <==> (ht1 == ht2)} | val eq_hint_type (ht1 ht2: proof_hint_type) : b: bool{b <==> (ht1 == ht2)} | let eq_hint_type (ht1 ht2:proof_hint_type)
: b:bool { b <==> (ht1 == ht2) }
= match ht1, ht2 with
| ASSERT { p=p1 }, ASSERT { p=p2 } ->
eq_tm p1 p2
| FOLD { names=ns1; p=p1}, FOLD { names=ns2; p=p2 }
| UNFOLD { names=ns1; p=p1}, UNFOLD { names=ns2; p=p2 } ->
eq_opt (eq_list (fun n1 n2 -> n1 = n2)) ns1 ns2 &&
eq_tm p1 p2
| RENAME { pairs=ps1; goal=p1 }, RENAME { pairs=ps2; goal=p2 } ->
eq_list (fun (x1, y1) (x2, y2) -> eq_tm x1 x2 && eq_tm y1 y2) ps1 ps2 &&
eq_opt eq_tm p1 p2
| REWRITE { t1; t2 }, REWRITE { t1=s1; t2=s2 } ->
eq_tm t1 s1 &&
eq_tm t2 s2
| WILD, WILD
| SHOW_PROOF_STATE _, SHOW_PROOF_STATE _ -> true
| _ -> false | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 16,
"end_line": 171,
"start_col": 0,
"start_line": 154
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> ()
let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | ht1: Pulse.Syntax.Base.proof_hint_type -> ht2: Pulse.Syntax.Base.proof_hint_type
-> b: Prims.bool{b <==> ht1 == ht2} | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.proof_hint_type",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.vprop",
"Pulse.Syntax.Base.eq_tm",
"FStar.Pervasives.Native.option",
"Prims.list",
"Prims.string",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_opt",
"Pulse.Syntax.Base.eq_list",
"Prims.op_Equality",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2",
"FStar.Pervasives.Native.tuple2",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.range"
] | [] | false | false | false | false | false | let eq_hint_type (ht1 ht2: proof_hint_type) : b: bool{b <==> (ht1 == ht2)} =
| match ht1, ht2 with
| ASSERT { p = p1 }, ASSERT { p = p2 } -> eq_tm p1 p2
| FOLD { names = ns1 ; p = p1 }, FOLD { names = ns2 ; p = p2 }
| UNFOLD { names = ns1 ; p = p1 }, UNFOLD { names = ns2 ; p = p2 } ->
eq_opt (eq_list (fun n1 n2 -> n1 = n2)) ns1 ns2 && eq_tm p1 p2
| RENAME { pairs = ps1 ; goal = p1 }, RENAME { pairs = ps2 ; goal = p2 } ->
eq_list (fun (x1, y1) (x2, y2) -> eq_tm x1 x2 && eq_tm y1 y2) ps1 ps2 && eq_opt eq_tm p1 p2
| REWRITE { t1 = t1 ; t2 = t2 }, REWRITE { t1 = s1 ; t2 = s2 } -> eq_tm t1 s1 && eq_tm t2 s2
| WILD, WILD | SHOW_PROOF_STATE _, SHOW_PROOF_STATE _ -> true
| _ -> false | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_fuel_default | val va_fuel_default : unit -> va_fuel | val va_fuel_default : unit -> va_fuel | let va_fuel_default () = 0 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.Decls.va_fuel | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.Decls.va_fuel"
] | [] | false | false | false | true | false | let va_fuel_default () =
| 0 | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_ascription | val eq_ascription (a1 a2: comp_ascription) : b: bool{b <==> (a1 == a2)} | val eq_ascription (a1 a2: comp_ascription) : b: bool{b <==> (a1 == a2)} | let eq_ascription (a1 a2:comp_ascription)
: b:bool { b <==> (a1 == a2) }
= eq_opt eq_comp a1.elaborated a2.elaborated &&
eq_opt eq_comp a1.annotated a2.annotated | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 43,
"end_line": 176,
"start_col": 0,
"start_line": 173
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> ()
let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2
let eq_hint_type (ht1 ht2:proof_hint_type)
: b:bool { b <==> (ht1 == ht2) }
= match ht1, ht2 with
| ASSERT { p=p1 }, ASSERT { p=p2 } ->
eq_tm p1 p2
| FOLD { names=ns1; p=p1}, FOLD { names=ns2; p=p2 }
| UNFOLD { names=ns1; p=p1}, UNFOLD { names=ns2; p=p2 } ->
eq_opt (eq_list (fun n1 n2 -> n1 = n2)) ns1 ns2 &&
eq_tm p1 p2
| RENAME { pairs=ps1; goal=p1 }, RENAME { pairs=ps2; goal=p2 } ->
eq_list (fun (x1, y1) (x2, y2) -> eq_tm x1 x2 && eq_tm y1 y2) ps1 ps2 &&
eq_opt eq_tm p1 p2
| REWRITE { t1; t2 }, REWRITE { t1=s1; t2=s2 } ->
eq_tm t1 s1 &&
eq_tm t2 s2
| WILD, WILD
| SHOW_PROOF_STATE _, SHOW_PROOF_STATE _ -> true
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | a1: Pulse.Syntax.Base.comp_ascription -> a2: Pulse.Syntax.Base.comp_ascription
-> b: Prims.bool{b <==> a1 == a2} | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.comp_ascription",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_opt",
"Pulse.Syntax.Base.comp",
"Pulse.Syntax.Base.eq_comp",
"Pulse.Syntax.Base.__proj__Mkcomp_ascription__item__elaborated",
"Pulse.Syntax.Base.__proj__Mkcomp_ascription__item__annotated",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [] | false | false | false | false | false | let eq_ascription (a1 a2: comp_ascription) : b: bool{b <==> (a1 == a2)} =
| eq_opt eq_comp a1.elaborated a2.elaborated && eq_opt eq_comp a1.annotated a2.annotated | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.sealed_list_eq | val sealed_list_eq (#a: _) (l1 l2: list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2)) | val sealed_list_eq (#a: _) (l1 l2: list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2)) | let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> () | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 131,
"start_col": 0,
"start_line": 124
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | l1: Prims.list (FStar.Sealed.sealed a) -> l2: Prims.list (FStar.Sealed.sealed a)
-> FStar.Pervasives.Lemma
(ensures FStar.List.Tot.Base.length l1 = FStar.List.Tot.Base.length l2 ==> l1 == l2) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Sealed.sealed",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.sealed_list_eq",
"Prims.unit",
"FStar.Sealed.sealed_singl",
"FStar.Pervasives.Native.tuple2",
"Prims.l_True",
"Prims.squash",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"FStar.List.Tot.Base.length",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"recursion"
] | false | false | true | false | false | let rec sealed_list_eq #a (l1: list (Sealed.sealed a)) (l2: list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2)) =
| match l1, l2 with
| [], [] -> ()
| h1 :: t1, h2 :: t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> () | false |
Vale.X64.Decls.fst | Vale.X64.Decls.valid_cf | val valid_cf (flags:Flags.t) : bool | val valid_cf (flags:Flags.t) : bool | let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 80,
"end_line": 20,
"start_col": 0,
"start_line": 20
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | flags: Vale.X64.Flags.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Flags.t",
"Vale.X64.Lemmas.cf",
"Prims.bool"
] | [] | false | false | false | true | false | let valid_cf flags =
| match Lemmas.cf flags with
| Some v -> true
| None -> false | false |
Vale.X64.Decls.fst | Vale.X64.Decls.eval_code | val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 | val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 | let eval_code = Lemmas.eval_code | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 101,
"start_col": 0,
"start_line": 101
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sN: Vale.X64.Decls.va_state
-> Vale.Def.Prop_s.prop0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Lemmas.eval_code"
] | [] | false | false | false | true | false | let eval_code =
| Lemmas.eval_code | false |
Vale.X64.Decls.fst | Vale.X64.Decls.taint_at | val taint_at (memTaint:M.memtaint) (addr:int) : taint | val taint_at (memTaint:M.memtaint) (addr:int) : taint | let taint_at memTaint addr = Map.sel memTaint addr | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 92,
"start_col": 0,
"start_line": 92
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | memTaint: Vale.X64.Memory.memtaint -> addr: Prims.int -> Vale.Arch.HeapTypes_s.taint | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Memory.memtaint",
"Prims.int",
"FStar.Map.sel",
"Vale.Arch.HeapTypes_s.taint"
] | [] | false | false | false | true | false | let taint_at memTaint addr =
| Map.sel memTaint addr | false |
Vale.X64.Decls.fst | Vale.X64.Decls.eval_ocmp | val eval_ocmp : s:va_state -> c:ocmp -> GTot bool | val eval_ocmp : s:va_state -> c:ocmp -> GTot bool | let eval_ocmp = Lemmas.eval_ocmp | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 113,
"start_col": 0,
"start_line": 113
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Vale.X64.Decls.va_state -> c: Vale.X64.Decls.ocmp -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Vale.X64.Lemmas.eval_ocmp"
] | [] | false | false | false | false | false | let eval_ocmp =
| Lemmas.eval_ocmp | false |
Vale.X64.Decls.fst | Vale.X64.Decls.cf | val cf (flags:Flags.t) : bool | val cf (flags:Flags.t) : bool | let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2" | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | flags: Vale.X64.Flags.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Flags.t",
"Vale.X64.Lemmas.cf",
"Prims.bool"
] | [] | false | false | false | true | false | let cf flags =
| match Lemmas.cf flags with
| Some v -> v
| None -> false | false |
Vale.X64.Decls.fst | Vale.X64.Decls.updated_cf | val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) | val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) | let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 22,
"start_col": 0,
"start_line": 22
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | new_flags: Vale.X64.Flags.t -> new_cf: Prims.bool -> Prims.Pure Prims.bool | Prims.Pure | [] | [] | [
"Vale.X64.Flags.t",
"Prims.bool",
"Prims.op_Equality",
"FStar.Pervasives.Native.option",
"Vale.X64.Lemmas.cf",
"FStar.Pervasives.Native.Some"
] | [] | false | false | false | false | false | let updated_cf new_flags new_cf =
| Lemmas.cf new_flags = Some new_cf | false |
Vale.X64.Decls.fst | Vale.X64.Decls.overflow | val overflow (flags:Flags.t) : bool | val overflow (flags:Flags.t) : bool | let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 83,
"end_line": 19,
"start_col": 0,
"start_line": 19
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2" | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | flags: Vale.X64.Flags.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Flags.t",
"Vale.X64.Lemmas.overflow",
"Prims.bool"
] | [] | false | false | false | true | false | let overflow flags =
| match Lemmas.overflow flags with
| Some v -> v
| None -> false | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_pattern | val eq_pattern (p1 p2: pattern) : b: bool{b <==> (p1 == p2)} | val eq_pattern (p1 p2: pattern) : b: bool{b <==> (p1 == p2)} | let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 29,
"end_line": 152,
"start_col": 0,
"start_line": 133
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | p1: Pulse.Syntax.Base.pattern -> p2: Pulse.Syntax.Base.pattern -> b: Prims.bool{b <==> p1 == p2} | Prims.Tot | [
"total"
] | [
"eq_pattern",
"eq_sub_pat"
] | [
"Pulse.Syntax.Base.pattern",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.fv",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Stubs.Reflection.Types.name",
"Pulse.Syntax.Base.__proj__Mkfv__item__fv_name",
"Pulse.Syntax.Base.eq_list_dec",
"Pulse.Syntax.Base.eq_sub_pat",
"Pulse.Syntax.Base.constant",
"Pulse.Syntax.Base.fstar_const_eq",
"FStar.Reflection.Typing.pp_name_t",
"FStar.Reflection.Typing.sort_t",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.eq_opt",
"Pulse.Syntax.Base.eq_tm",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec eq_pattern (p1 p2: pattern) : b: bool{b <==> (p1 == p2)} =
| match p1, p2 with
| Pat_Cons f1 vs1, Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name && eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 -> fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_eval_ins | val va_eval_ins : c: Vale.X64.Lemmas.code -> s0: Vale.X64.State.vale_state
-> Prims.Ghost (Vale.X64.State.vale_state * Vale.X64.Lemmas.fuel) | let va_eval_ins = Lemmas.eval_ins | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 117,
"start_col": 7,
"start_line": 117
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Vale.X64.Lemmas.code -> s0: Vale.X64.State.vale_state
-> Prims.Ghost (Vale.X64.State.vale_state * Vale.X64.Lemmas.fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.eval_ins"
] | [] | false | false | false | false | false | let va_eval_ins =
| Lemmas.eval_ins | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.havoc_flags | val havoc_flags : Flags.t | val havoc_flags : Flags.t | let havoc_flags = Lemmas.havoc_flags | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 115,
"start_col": 0,
"start_line": 115
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Flags.t | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Lemmas.havoc_flags"
] | [] | false | false | false | true | false | let havoc_flags =
| Lemmas.havoc_flags | false |
Vale.X64.Decls.fst | Vale.X64.Decls.valid_of | val valid_of (flags:Flags.t) : bool | val valid_of (flags:Flags.t) : bool | let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 86,
"end_line": 21,
"start_col": 0,
"start_line": 21
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | flags: Vale.X64.Flags.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Flags.t",
"Vale.X64.Lemmas.overflow",
"Prims.bool"
] | [] | false | false | false | true | false | let valid_of flags =
| match Lemmas.overflow flags with
| Some v -> true
| None -> false | false |
Vale.X64.Decls.fst | Vale.X64.Decls.get_reason | val get_reason (p:va_pbool) : option string | val get_reason (p:va_pbool) : option string | let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 37,
"start_col": 0,
"start_line": 34
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Vale.X64.Decls.va_pbool -> FStar.Pervasives.Native.option Prims.string | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_pbool",
"FStar.Pervasives.Native.None",
"Prims.string",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let get_reason p =
| match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason | false |
Vale.X64.Decls.fst | Vale.X64.Decls.valid_ocmp | val valid_ocmp : c:ocmp -> s:va_state -> GTot bool | val valid_ocmp : c:ocmp -> s:va_state -> GTot bool | let valid_ocmp = Lemmas.valid_ocmp | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 114,
"start_col": 0,
"start_line": 114
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Vale.X64.Decls.ocmp -> s: Vale.X64.Decls.va_state -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Vale.X64.Lemmas.valid_ocmp"
] | [] | false | false | false | false | false | let valid_ocmp =
| Lemmas.valid_ocmp | false |
Vale.X64.Decls.fst | Vale.X64.Decls.eval_while_inv | val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 | val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 | let eval_while_inv = Lemmas.eval_while_inv | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 102,
"start_col": 0,
"start_line": 102
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
fW: Vale.X64.Decls.va_fuel ->
sW: Vale.X64.Decls.va_state
-> Vale.Def.Prop_s.prop0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Lemmas.eval_while_inv"
] | [] | false | false | false | true | false | let eval_while_inv =
| Lemmas.eval_while_inv | false |
Vale.X64.Decls.fst | Vale.X64.Decls.maintained_cf | val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) | val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) | let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | new_flags: Vale.X64.Flags.t -> flags: Vale.X64.Flags.t -> Prims.Pure Prims.bool | Prims.Pure | [] | [] | [
"Vale.X64.Flags.t",
"Prims.op_Equality",
"Vale.X64.Flags.flag_val_t",
"Vale.X64.Lemmas.cf",
"Prims.bool"
] | [] | false | false | false | false | false | let maintained_cf new_flags flags =
| Lemmas.cf new_flags = Lemmas.cf flags | false |
Vale.X64.Decls.fst | Vale.X64.Decls.maintained_of | val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) | val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) | let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 85,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | new_flags: Vale.X64.Flags.t -> flags: Vale.X64.Flags.t -> Prims.Pure Prims.bool | Prims.Pure | [] | [] | [
"Vale.X64.Flags.t",
"Prims.op_Equality",
"Vale.X64.Flags.flag_val_t",
"Vale.X64.Lemmas.overflow",
"Prims.bool"
] | [] | false | false | false | false | false | let maintained_of new_flags flags =
| Lemmas.overflow new_flags = Lemmas.overflow flags | false |
Steel.ST.Array.Swap.fst | Steel.ST.Array.Swap.swap | val swap
(#t: Type0)
(#s0: Ghost.erased (Seq.seq t))
(a: array t)
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to a full_perm s0)
(fun s -> pts_to a full_perm s)
(
SZ.v n == length a /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
) | val swap
(#t: Type0)
(#s0: Ghost.erased (Seq.seq t))
(a: array t)
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to a full_perm s0)
(fun s -> pts_to a full_perm s)
(
SZ.v n == length a /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
) | let swap
a n l
= pts_to_length a _;
Gen.array_swap_gen (array_index a) (array_upd a) _ n l | {
"file_name": "lib/steel/Steel.ST.Array.Swap.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 56,
"end_line": 31,
"start_col": 0,
"start_line": 28
} | module Steel.ST.Array.Swap
open Steel.ST.GenElim
open Steel.ST.Array // for pts_to
module Gen = Steel.ST.GenArraySwap
[@@__reduce__]
let array_pts_to (#t: Type) (a: array t) : Tot (Gen.array_pts_to_t t) =
fun s -> pts_to a full_perm (Ghost.reveal s)
inline_for_extraction
let array_index
(#t: Type)
(a: array t)
: Tot (Gen.array_index_t (array_pts_to a))
= fun s n i ->
index a i
inline_for_extraction
let array_upd
(#t: Type)
(a: array t)
: Tot (Gen.array_upd_t (array_pts_to a))
= fun s n i x ->
upd a i x;
return _ | {
"checked_file": "/",
"dependencies": [
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.fsti.checked",
"Steel.ST.Array.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Array.Swap.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.ST.Array // for pts_to",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap",
"short_module": "Gen"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": 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: Steel.ST.Array.array t -> n: FStar.SizeT.t -> l: FStar.SizeT.t
-> Steel.ST.Effect.ST (FStar.Ghost.erased (FStar.Seq.Base.seq t)) | Steel.ST.Effect.ST | [] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Array.array",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.array_swap_gen",
"Steel.ST.Array.Swap.array_pts_to",
"Steel.ST.Array.Swap.array_index",
"Steel.ST.Array.Swap.array_upd",
"Prims.unit",
"Steel.ST.Array.pts_to_length",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.FractionalPermission.full_perm",
"FStar.Ghost.reveal"
] | [] | false | true | false | false | false | let swap a n l =
| pts_to_length a _;
Gen.array_swap_gen (array_index a) (array_upd a) _ n l | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_ge | val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_ge o1 o2 = BC.OGe o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 97,
"start_col": 0,
"start_line": 97
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OGe",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_ge o1 o2 =
| BC.OGe o1 o2 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_compute_merge_total | val va_compute_merge_total (f0:va_fuel) (fM:va_fuel) : va_fuel | val va_compute_merge_total (f0:va_fuel) (fM:va_fuel) : va_fuel | let va_compute_merge_total = Lemmas.compute_merge_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 55,
"end_line": 133,
"start_col": 0,
"start_line": 133
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = () | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f0: Vale.X64.Decls.va_fuel -> fM: Vale.X64.Decls.va_fuel -> Vale.X64.Decls.va_fuel | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Lemmas.compute_merge_total"
] | [] | false | false | false | true | false | let va_compute_merge_total =
| Lemmas.compute_merge_total | false |
Vale.X64.Decls.fst | Vale.X64.Decls.updated_of | val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) | val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) | let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 23,
"start_col": 0,
"start_line": 23
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | new_flags: Vale.X64.Flags.t -> new_of: Prims.bool -> Prims.Pure Prims.bool | Prims.Pure | [] | [] | [
"Vale.X64.Flags.t",
"Prims.bool",
"Prims.op_Equality",
"FStar.Pervasives.Native.option",
"Vale.X64.Lemmas.overflow",
"FStar.Pervasives.Native.Some"
] | [] | false | false | false | false | false | let updated_of new_flags new_cf =
| Lemmas.overflow new_flags = Some new_cf | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_eq | val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_eq o1 o2 = BC.OEq o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 94,
"start_col": 0,
"start_line": 94
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OEq",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_eq o1 o2 =
| BC.OEq o1 o2 | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.load_stack64 | val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64 | val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64 | let load_stack64 i st = BS.eval_stack i st | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 9,
"start_col": 0,
"start_line": 9
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Vale.PPC64LE.Memory.nat64 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.eval_stack",
"Vale.PPC64LE.Memory.nat64"
] | [] | false | false | false | false | false | let load_stack64 i st =
| BS.eval_stack i st | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_ne | val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_ne o1 o2 = BC.ONe o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 95,
"start_col": 0,
"start_line": 95
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.ONe",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_ne o1 o2 =
| BC.ONe o1 o2 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.lemma_opr_Mem64 | val lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) | val lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) | let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 66,
"start_col": 0,
"start_line": 44
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
id: Vale.X64.Decls.heaplet_id ->
s: Vale.X64.Decls.va_state ->
base: Vale.X64.Machine_s.operand64 ->
offset: Prims.int ->
b: Vale.X64.Memory.buffer64 ->
index: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> FStar.Pervasives.Lemma
(requires
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Memory.mem_inv (Mkvale_state?.vs_heap s) /\ OReg? base /\
Vale.X64.Decls.valid_src_addr h b index /\
Vale.X64.Memory.valid_layout_buffer b
(Mkvale_full_heap?.vf_layout (Mkvale_state?.vs_heap s))
h
false /\
Vale.X64.Memory.valid_taint_buf64 b
h
(Vale.Arch.HeapImpl.full_heap_taint (Mkvale_state?.vs_heap s))
t /\
Vale.X64.State.eval_operand base s + offset == Vale.X64.Memory.buffer_addr b h + 8 * index
))
(ensures
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Decls.valid_operand (Vale.X64.Decls.va_opr_code_Mem64 id base offset t) s /\
Vale.X64.Memory.load_mem64 (Vale.X64.Memory.buffer_addr b h + 8 * index)
(Mkvale_full_heap?.vf_heap (Mkvale_state?.vs_heap s)) ==
Vale.X64.Memory.buffer_read b index h)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Decls.heaplet_id",
"Vale.X64.Decls.va_state",
"Vale.X64.Machine_s.operand64",
"Prims.int",
"Vale.X64.Memory.buffer64",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Machine_s.maddr",
"Vale.X64.Memory.lemma_load_mem64",
"Prims.unit",
"Prims._assert",
"Vale.X64.Decls.valid_buf_maddr64",
"Vale.X64.State.eval_maddr",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Vale.X64.Memory.lemma_valid_mem64",
"Vale.X64.Decls.va_opr_code_Mem64",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap",
"Vale.X64.Memory_Sems.low_lemma_load_mem64_full",
"Prims.l_and",
"Vale.X64.Memory.mem_inv",
"Prims.b2t",
"Vale.X64.Machine_s.uu___is_OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Decls.valid_src_addr",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.valid_layout_buffer",
"Vale.X64.Memory.valid_taint_buf64",
"Vale.Arch.HeapImpl.full_heap_taint",
"Prims.eq2",
"Prims.op_Addition",
"Vale.X64.State.eval_operand",
"Vale.X64.Memory.buffer_addr",
"FStar.Mul.op_Star",
"Vale.Lib.Map16.sel",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets",
"Prims.squash",
"Vale.X64.Decls.valid_operand",
"Prims.nat",
"Prims.l_or",
"Prims.op_LessThan",
"Vale.Def.Words_s.pow2_64",
"Vale.X64.Memory.load_mem64",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap",
"Vale.X64.Memory.buffer_read",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) =
| Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_ins_lemma | val va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) | val va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) | let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 111,
"start_col": 0,
"start_line": 104
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c0: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state
-> FStar.Pervasives.Lemma
(ensures
forall (i: Vale.X64.Decls.ins) (s: Vale.X64.Machine_Semantics_s.machine_state).
{:pattern Vale.X64.Machine_Semantics_s.machine_eval_code_ins i s}
Vale.X64.Machine_Semantics_s.machine_eval_code_ins i s ==
Vale.X64.Machine_Semantics_s.machine_eval_code_ins_def i s) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"FStar.Pervasives.reveal_opaque",
"Vale.X64.Machine_Semantics_s.ins",
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.Pervasives.Native.option",
"Vale.X64.Machine_Semantics_s.machine_eval_code_ins",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Vale.X64.Decls.ins",
"Prims.eq2",
"Vale.X64.Machine_Semantics_s.machine_eval_code_ins_def",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) =
| reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.vale_stack | val vale_stack : Type u#0 | val vale_stack : Type u#0 | let vale_stack = machine_stack | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 6,
"start_col": 0,
"start_line": 6
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Machine_s.machine_stack"
] | [] | false | false | false | true | true | let vale_stack =
| machine_stack | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.valid_src_stack64 | val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool | val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool | let valid_src_stack64 i st = BS.valid_src_stack64 i st | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 54,
"end_line": 8,
"start_col": 0,
"start_line": 8
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.valid_src_stack64",
"Prims.bool"
] | [] | false | false | false | false | false | let valid_src_stack64 i st =
| BS.valid_src_stack64 i st | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.load_stack128 | val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32 | val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32 | let load_stack128 i st = BS.eval_stack128 i st | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 14,
"start_col": 0,
"start_line": 14
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Vale.PPC64LE.Memory.quad32 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.eval_stack128",
"Vale.PPC64LE.Memory.quad32"
] | [] | false | false | false | false | false | let load_stack128 i st =
| BS.eval_stack128 i st | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.free_stack64 | val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | let free_stack64 start finish h = BS.free_stack' start finish h | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 11,
"start_col": 0,
"start_line": 11
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | start: Prims.int -> finish: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.free_stack'"
] | [] | false | false | false | false | false | let free_stack64 start finish h =
| BS.free_stack' start finish h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_lt | val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_lt o1 o2 = BC.OLt o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 98,
"start_col": 0,
"start_line": 98
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OLt",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_lt o1 o2 =
| BC.OLt o1 o2 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_le | val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_le o1 o2 = BC.OLe o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 96,
"start_col": 0,
"start_line": 96
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OLe",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_le o1 o2 =
| BC.OLe o1 o2 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.lemma_opr_Mem128 | val lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) | val lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) | let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 90,
"start_col": 0,
"start_line": 68
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
id: Vale.X64.Decls.heaplet_id ->
s: Vale.X64.Decls.va_state ->
base: Vale.X64.Machine_s.operand64 ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.X64.Memory.buffer128 ->
index: Prims.int
-> FStar.Pervasives.Lemma
(requires
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Memory.mem_inv (Mkvale_state?.vs_heap s) /\ OReg? base /\
Vale.X64.Decls.valid_src_addr h b index /\
Vale.X64.Memory.valid_layout_buffer b
(Mkvale_full_heap?.vf_layout (Mkvale_state?.vs_heap s))
h
false /\
Vale.X64.Memory.valid_taint_buf128 b
h
(Vale.Arch.HeapImpl.full_heap_taint (Mkvale_state?.vs_heap s))
t /\
Vale.X64.State.eval_operand base s + offset ==
Vale.X64.Memory.buffer_addr b h + 16 * index))
(ensures
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Decls.valid_operand128 (Vale.X64.Decls.va_opr_code_Mem128 id base offset t) s /\
Vale.X64.Memory.load_mem128 (Vale.X64.Memory.buffer_addr b h + 16 * index)
(Vale.X64.Memory.get_vale_heap (Mkvale_state?.vs_heap s)) ==
Vale.X64.Memory.buffer_read b index h)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Decls.heaplet_id",
"Vale.X64.Decls.va_state",
"Vale.X64.Machine_s.operand64",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Memory.buffer128",
"Vale.X64.Machine_s.maddr",
"Vale.X64.Memory.lemma_load_mem128",
"Prims.unit",
"Prims._assert",
"Vale.X64.Decls.valid_buf_maddr128",
"Vale.X64.State.eval_maddr",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Vale.X64.Machine_s.operand128",
"Vale.X64.Memory.lemma_valid_mem128",
"Vale.X64.Decls.va_opr_code_Mem128",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap",
"Vale.X64.Memory_Sems.low_lemma_load_mem128_full",
"Prims.l_and",
"Vale.X64.Memory.mem_inv",
"Prims.b2t",
"Vale.X64.Machine_s.uu___is_OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Decls.valid_src_addr",
"Vale.X64.Memory.vuint128",
"Vale.X64.Memory.valid_layout_buffer",
"Vale.X64.Memory.valid_taint_buf128",
"Vale.Arch.HeapImpl.full_heap_taint",
"Prims.eq2",
"Prims.op_Addition",
"Vale.X64.State.eval_operand",
"Vale.X64.Memory.buffer_addr",
"FStar.Mul.op_Star",
"Vale.Lib.Map16.sel",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets",
"Prims.squash",
"Vale.X64.Decls.valid_operand128",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Memory.load_mem128",
"Vale.X64.Memory.buffer_read",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) =
| Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.print_footer | val print_footer : printer -> FStar.All.ML unit | val print_footer : printer -> FStar.All.ML unit | let print_footer = P.print_footer | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 148,
"start_col": 0,
"start_line": 148
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer
let print_string = FStar.IO.print_string
let print_header = P.print_header | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Vale.X64.Decls.printer -> FStar.All.ML Prims.unit | FStar.All.ML | [
"ml"
] | [] | [
"Vale.X64.Print_s.print_footer"
] | [] | false | true | false | false | false | let print_footer =
| P.print_footer | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.store_stack128 | val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack | val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack | let store_stack128 i v h = BS.update_stack128' i v h | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> v: Vale.PPC64LE.Memory.quad32 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.update_stack128'"
] | [] | false | false | false | false | false | let store_stack128 i v h =
| BS.update_stack128' i v h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.print_proc | val print_proc : (name:string) -> (code:va_code) -> (label:int) -> (p:printer) -> FStar.All.ML int | val print_proc : (name:string) -> (code:va_code) -> (label:int) -> (p:printer) -> FStar.All.ML int | let print_proc = P.print_proc | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 147,
"start_col": 0,
"start_line": 147
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer
let print_string = FStar.IO.print_string | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | name: Prims.string -> code: Vale.X64.Decls.va_code -> label: Prims.int -> p: Vale.X64.Decls.printer
-> FStar.All.ML Prims.int | FStar.All.ML | [
"ml"
] | [] | [
"Vale.X64.Print_s.print_proc"
] | [] | false | true | false | false | false | let print_proc =
| P.print_proc | false |
Vale.X64.Decls.fst | Vale.X64.Decls.print_header | val print_header : printer -> FStar.All.ML unit | val print_header : printer -> FStar.All.ML unit | let print_header = P.print_header | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 146,
"start_col": 0,
"start_line": 146
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Vale.X64.Decls.printer -> FStar.All.ML Prims.unit | FStar.All.ML | [
"ml"
] | [] | [
"Vale.X64.Print_s.print_header"
] | [] | false | true | false | false | false | let print_header =
| P.print_header | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.valid_src_stack128 | val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool | val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool | let valid_src_stack128 i st = BS.valid_src_stack128 i st | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 56,
"end_line": 13,
"start_col": 0,
"start_line": 13
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.valid_src_stack128",
"Prims.bool"
] | [] | false | false | false | false | false | let valid_src_stack128 i st =
| BS.valid_src_stack128 i st | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.store_stack64 | val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack | val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack | let store_stack64 i v h = BS.update_stack64' i v h | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 10,
"start_col": 0,
"start_line": 10
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.update_stack64'"
] | [] | false | false | false | false | false | let store_stack64 i v h =
| BS.update_stack64' i v h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.printer | val printer : Type0 | val printer : Type0 | let printer = P.printer | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 144,
"start_col": 0,
"start_line": 144
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Print_s.printer"
] | [] | false | false | false | true | true | let printer =
| P.printer | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.free_stack128 | val free_stack128 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | val free_stack128 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | let free_stack128 start finish h = BS.free_stack' start finish h | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 16,
"start_col": 0,
"start_line": 16
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | start: Prims.int -> finish: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.free_stack'"
] | [] | false | false | false | false | false | let free_stack128 start finish h =
| BS.free_stack' start finish h | false |
Vale.X64.Decls.fst | Vale.X64.Decls.masm | val masm : printer | val masm : printer | let masm = P.masm | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 17,
"end_line": 149,
"start_col": 0,
"start_line": 149
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer
let print_string = FStar.IO.print_string
let print_header = P.print_header
let print_proc = P.print_proc | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Decls.printer | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Print_s.masm"
] | [] | false | false | false | true | false | let masm =
| P.masm | false |
Vale.X64.Decls.fst | Vale.X64.Decls.gcc_linux | val gcc_linux : printer | val gcc_linux : printer | let gcc_linux = P.gcc_linux | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 27,
"end_line": 151,
"start_col": 0,
"start_line": 151
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer
let print_string = FStar.IO.print_string
let print_header = P.print_header
let print_proc = P.print_proc
let print_footer = P.print_footer
let masm = P.masm | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Decls.printer | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Print_s.gcc_linux"
] | [] | false | false | false | true | false | let gcc_linux =
| P.gcc_linux | false |
Vale.X64.Decls.fst | Vale.X64.Decls.print_string | val print_string : string -> FStar.All.ML unit | val print_string : string -> FStar.All.ML unit | let print_string = FStar.IO.print_string | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 145,
"start_col": 0,
"start_line": 145
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.string -> FStar.All.ML Prims.unit | FStar.All.ML | [
"ml"
] | [] | [
"FStar.IO.print_string"
] | [] | false | true | false | false | false | let print_string =
| FStar.IO.print_string | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.init_r1 | val init_r1 (h:vale_stack) : (n:nat64{n >= 65536}) | val init_r1 (h:vale_stack) : (n:nat64{n >= 65536}) | let init_r1 h = h.initial_r1 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: Vale.PPC64LE.Stack_i.vale_stack -> n: Vale.PPC64LE.Memory.nat64{n >= 65536} | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.__proj__Machine_stack__item__initial_r1",
"Vale.PPC64LE.Memory.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual"
] | [] | false | false | false | false | false | let init_r1 h =
| h.initial_r1 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.gcc | val gcc : printer | val gcc : printer | let gcc = P.gcc | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 150,
"start_col": 0,
"start_line": 150
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total
let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total
let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total
let printer = P.printer
let print_string = FStar.IO.print_string
let print_header = P.print_header
let print_proc = P.print_proc
let print_footer = P.print_footer | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Decls.printer | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Print_s.gcc"
] | [] | false | false | false | true | false | let gcc =
| P.gcc | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_cmp_gt | val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | let va_cmp_gt o1 o2 = BC.OGt o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 99,
"start_col": 0,
"start_line": 99
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OGt",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | false | false | let va_cmp_gt o1 o2 =
| BC.OGt o1 o2 | false |
NatHeap.fsti | NatHeap.max | val max (n m: nat) : nat | val max (n m: nat) : nat | let max (n m:nat) : nat =
if n > m then n else m | {
"file_name": "examples/preorders/NatHeap.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 24,
"end_line": 120,
"start_col": 0,
"start_line": 119
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module NatHeap
open FStar.Preorder
(* Heap is a tuple of a source of freshness (the no. of the next
reference to be allocated) and a mapping of allocated raw
references (represented as natural numbers) to types and values. *)
(* NB: (a:Type0 & a) instead of dtuple2 is better notation *)
module F = FStar.FunctionalExtensionality
//abstract
val heap: Type u#1
(* Consistency of heaps. aka, no strong updates *)
val consistent (h0:heap) (h1:heap) : GTot Type0
(* References. *)
val ref (a:Type0) : Type0
//type aref =
// | Ref : a:Type -> r:ref a -> aref
(* Containment predicate on heaps. *)
val contains (#a:Type) (h:heap) (r:ref a) : GTot Type0
//NB: Some? (snd h r), would avoid the existential, but would not capture the type equality
//NB: match snd h r with | Some (| b, _ |) -> a == b | _ -> False
// this style would avoid the existential
//NB: Although, it appears that the existential variable actually seems to help in this case
// would be good to understand why (at some point)
(* Select. *)
val sel : #a:Type ->
h:heap ->
r:ref a{contains h r} ->
Tot a
(* Generating a fresh reference for the given heap. *)
val alloc_ref : h0:heap ->
a:Type ->
x:a ->
Tot (rh1:(ref a * heap)
{~(contains h0 (fst rh1)) /\
contains (snd rh1) (fst rh1) /\
sel (snd rh1) (fst rh1) == x /\
(forall b (r:ref b) .{:pattern (contains h0 r)}
contains h0 r
==>
contains (snd rh1) r) /\
(forall b (r:ref b{contains h0 r}) . {:pattern sel #b h0 r}
sel #b h0 r == sel #b (snd rh1) r)})
(* Update. *)
val upd : #a:Type ->
h0:heap ->
r:ref a{contains h0 r} ->
x:a ->
Tot (h1:heap{contains h1 r /\
sel h1 r == x /\
(forall b (r':ref b) . {:pattern (contains h0 r')}
contains h0 r'
==>
contains h1 r') /\
(forall b (r':ref b{contains h0 r'}) . {:pattern sel h0 r'}
~(r === r') ==>
sel h0 r' == sel h1 r')})
(* Empty. *)
val emp : heap
(*
(* Domain. *)
open FStar.Set
private val domain_acc : h:heap -> n:nat{n <= fst h} -> Tot (set aref)
let rec domain_acc h n =
if n = 0 then empty
else (match snd h (n - 1) with
| Some (| a , _ |) -> let r:ref a = n - 1 in
union (singleton (Ref a r)) (domain_acc h (n - 1))) //Universe problem with (Ref a r)
val domain : heap -> Tot (set aref)
let domain h = domain_acc h (fst h)
*) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "NatHeap.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Set",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "FStar.Preorder",
"short_module": null
},
{
"abbrev": 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 | n: Prims.nat -> m: Prims.nat -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.op_GreaterThan",
"Prims.bool"
] | [] | false | false | false | true | false | let max (n m: nat) : nat =
| if n > m then n else m | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_st_term | val eq_st_term (t1 t2:st_term)
: b:bool { b <==> (t1 == t2) } | val eq_st_term (t1 t2:st_term)
: b:bool { b <==> (t1 == t2) } | let rec eq_st_term (t1 t2:st_term)
: b:bool { b <==> (t1 == t2) }
= match t1.term, t2.term with
| Tm_Return {expected_type=ty1; insert_eq=b1; term=t1},
Tm_Return {expected_type=ty2; insert_eq=b2; term=t2} ->
eq_tm ty1 ty2 &&
b1 = b2 &&
eq_tm t1 t2
| Tm_Abs { b=b1; q=o1; ascription=c1; body=t1 },
Tm_Abs { b=b2; q=o2; ascription=c2; body=t2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
o1=o2 &&
eq_ascription c1 c2 &&
eq_st_term t1 t2
| Tm_STApp { head=h1; arg_qual=o1; arg=t1},
Tm_STApp { head=h2; arg_qual=o2; arg=t2} ->
eq_tm h1 h2 &&
o1=o2 &&
eq_tm t1 t2
| Tm_Bind { binder=b1; head=t1; body=k1 },
Tm_Bind { binder=b2; head=t2; body=k2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
eq_st_term t1 t2 &&
eq_st_term k1 k2
| Tm_TotBind { binder=b1; head=t1; body=k1 },
Tm_TotBind { binder=b2; head=t2; body=k2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
eq_tm t1 t2 &&
eq_st_term k1 k2
| Tm_IntroPure { p=p1 }, Tm_IntroPure { p=p2 } ->
eq_tm p1 p2
| Tm_IntroExists { p=p1; witnesses=l1 },
Tm_IntroExists { p=p2; witnesses=l2 } ->
eq_tm p1 p2 &&
eq_tm_list l1 l2
| Tm_ElimExists {p=p1},
Tm_ElimExists {p=p2} ->
eq_tm p1 p2
| Tm_If { b=g1; then_=ethen1; else_=eelse1; post=p1},
Tm_If { b=g2; then_=ethen2; else_=eelse2; post=p2} ->
eq_tm g1 g2 &&
eq_st_term ethen1 ethen2 &&
eq_st_term eelse1 eelse2 &&
eq_tm_opt p1 p2
| Tm_Match {sc=sc1; returns_=r1; brs=br1},
Tm_Match {sc=sc2; returns_=r2; brs=br2} ->
eq_tm sc1 sc2 &&
eq_tm_opt r1 r2 &&
eq_list_dec t1 t2 eq_branch br1 br2
| Tm_While { invariant=inv1; condition=cond1; body=body1 },
Tm_While { invariant=inv2; condition=cond2; body=body2 } ->
eq_tm inv1 inv2 &&
eq_st_term cond1 cond2 &&
eq_st_term body1 body2
| Tm_Par {pre1=preL1; body1=eL1; post1=postL1; pre2=preR1; body2=eR1; post2=postR1 },
Tm_Par {pre1=preL2; body1=eL2; post1=postL2; pre2=preR2; body2=eR2; post2=postR2 } ->
eq_tm preL1 preL2 &&
eq_st_term eL1 eL2 &&
eq_tm postL1 postL2 &&
eq_tm preR1 preR2 &&
eq_st_term eR1 eR2 &&
eq_tm postR1 postR2
| Tm_WithLocal { binder=x1; initializer=e1; body=b1 },
Tm_WithLocal { binder=x2; initializer=e2; body=b2 } ->
eq_tm x1.binder_ty x2.binder_ty &&
eq_tm e1 e2 &&
eq_st_term b1 b2
| Tm_WithLocalArray { binder=x1; initializer=e1; length=n1; body=b1 },
Tm_WithLocalArray { binder=x2; initializer=e2; length=n2; body=b2 } ->
eq_tm x1.binder_ty x2.binder_ty &&
eq_tm e1 e2 &&
eq_tm n1 n2 &&
eq_st_term b1 b2
| Tm_Rewrite { t1=l1; t2=r1 },
Tm_Rewrite { t1=l2; t2=r2 } ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Admit { ctag=c1; u=u1; typ=t1; post=post1 },
Tm_Admit { ctag=c2; u=u2; typ=t2; post=post2 } ->
c1 = c2 &&
eq_univ u1 u2 &&
eq_tm t1 t2 &&
eq_tm_opt post1 post2
| Tm_Unreachable, Tm_Unreachable -> true
| Tm_ProofHintWithBinders { hint_type=ht1; binders=bs1; t=t1 },
Tm_ProofHintWithBinders { hint_type=ht2; binders=bs2; t=t2 } ->
eq_hint_type ht1 ht2 &&
eq_list eq_binder bs1 bs2 &&
eq_st_term t1 t2
| Tm_WithInv {name=name1; returns_inv=r1; body=body1},
Tm_WithInv {name=name2; returns_inv=r2; body=body2} ->
eq_tm name1 name2 &&
eq_opt (fun (b1, r1) (b2, r2) -> eq_tm b1.binder_ty b2.binder_ty && eq_tm r1 r2)
r1 r2 &&
eq_st_term body1 body2
| _ -> false
and eq_branch (b1 b2 : pattern & st_term)
: b:bool{b <==> (b1 == b2)}
= let (p1, e1) = b1 in
let (p2, e2) = b2 in
eq_pattern p1 p2 && eq_st_term e1 e2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 299,
"start_col": 0,
"start_line": 179
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> ()
let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2
let eq_hint_type (ht1 ht2:proof_hint_type)
: b:bool { b <==> (ht1 == ht2) }
= match ht1, ht2 with
| ASSERT { p=p1 }, ASSERT { p=p2 } ->
eq_tm p1 p2
| FOLD { names=ns1; p=p1}, FOLD { names=ns2; p=p2 }
| UNFOLD { names=ns1; p=p1}, UNFOLD { names=ns2; p=p2 } ->
eq_opt (eq_list (fun n1 n2 -> n1 = n2)) ns1 ns2 &&
eq_tm p1 p2
| RENAME { pairs=ps1; goal=p1 }, RENAME { pairs=ps2; goal=p2 } ->
eq_list (fun (x1, y1) (x2, y2) -> eq_tm x1 x2 && eq_tm y1 y2) ps1 ps2 &&
eq_opt eq_tm p1 p2
| REWRITE { t1; t2 }, REWRITE { t1=s1; t2=s2 } ->
eq_tm t1 s1 &&
eq_tm t2 s2
| WILD, WILD
| SHOW_PROOF_STATE _, SHOW_PROOF_STATE _ -> true
| _ -> false
let eq_ascription (a1 a2:comp_ascription)
: b:bool { b <==> (a1 == a2) }
= eq_opt eq_comp a1.elaborated a2.elaborated &&
eq_opt eq_comp a1.annotated a2.annotated | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 | t1: Pulse.Syntax.Base.st_term -> t2: Pulse.Syntax.Base.st_term -> b: Prims.bool{b <==> t1 == t2} | Prims.Tot | [
"total"
] | [
"eq_st_term",
"eq_branch"
] | [
"Pulse.Syntax.Base.st_term",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.st_term'",
"Pulse.Syntax.Base.__proj__Mkst_term__item__term",
"Pulse.Syntax.Base.term",
"Prims.bool",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_tm",
"Prims.op_Equality",
"Pulse.Syntax.Base.binder",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Base.comp_ascription",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty",
"Pulse.Syntax.Base.eq_ascription",
"Pulse.Syntax.Base.eq_st_term",
"Pulse.Syntax.Base.vprop",
"Prims.list",
"Pulse.Syntax.Base.eq_tm_list",
"Pulse.Syntax.Base.eq_tm_opt",
"FStar.Pervasives.Native.tuple2",
"Pulse.Syntax.Base.pattern",
"Pulse.Syntax.Base.eq_list_dec",
"Pulse.Syntax.Base.eq_branch",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.ctag",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.eq_univ",
"Pulse.Syntax.Base.proof_hint_type",
"Pulse.Syntax.Base.eq_hint_type",
"Pulse.Syntax.Base.eq_list",
"Pulse.Syntax.Base.eq_binder",
"Pulse.Syntax.Base.eq_opt",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec eq_st_term (t1 t2: st_term) : b: bool{b <==> (t1 == t2)} =
| match t1.term, t2.term with
| Tm_Return { expected_type = ty1 ; insert_eq = b1 ; term = t1 },
Tm_Return { expected_type = ty2 ; insert_eq = b2 ; term = t2 } ->
eq_tm ty1 ty2 && b1 = b2 && eq_tm t1 t2
| Tm_Abs { b = b1 ; q = o1 ; ascription = c1 ; body = t1 },
Tm_Abs { b = b2 ; q = o2 ; ascription = c2 ; body = t2 } ->
eq_tm b1.binder_ty b2.binder_ty && o1 = o2 && eq_ascription c1 c2 && eq_st_term t1 t2
| Tm_STApp { head = h1 ; arg_qual = o1 ; arg = t1 },
Tm_STApp { head = h2 ; arg_qual = o2 ; arg = t2 } ->
eq_tm h1 h2 && o1 = o2 && eq_tm t1 t2
| Tm_Bind { binder = b1 ; head = t1 ; body = k1 }, Tm_Bind { binder = b2 ; head = t2 ; body = k2 } ->
eq_tm b1.binder_ty b2.binder_ty && eq_st_term t1 t2 && eq_st_term k1 k2
| Tm_TotBind { binder = b1 ; head = t1 ; body = k1 },
Tm_TotBind { binder = b2 ; head = t2 ; body = k2 } ->
eq_tm b1.binder_ty b2.binder_ty && eq_tm t1 t2 && eq_st_term k1 k2
| Tm_IntroPure { p = p1 }, Tm_IntroPure { p = p2 } -> eq_tm p1 p2
| Tm_IntroExists { p = p1 ; witnesses = l1 }, Tm_IntroExists { p = p2 ; witnesses = l2 } ->
eq_tm p1 p2 && eq_tm_list l1 l2
| Tm_ElimExists { p = p1 }, Tm_ElimExists { p = p2 } -> eq_tm p1 p2
| Tm_If { b = g1 ; then_ = ethen1 ; else_ = eelse1 ; post = p1 },
Tm_If { b = g2 ; then_ = ethen2 ; else_ = eelse2 ; post = p2 } ->
eq_tm g1 g2 && eq_st_term ethen1 ethen2 && eq_st_term eelse1 eelse2 && eq_tm_opt p1 p2
| Tm_Match { sc = sc1 ; returns_ = r1 ; brs = br1 },
Tm_Match { sc = sc2 ; returns_ = r2 ; brs = br2 } ->
eq_tm sc1 sc2 && eq_tm_opt r1 r2 && eq_list_dec t1 t2 eq_branch br1 br2
| Tm_While { invariant = inv1 ; condition = cond1 ; body = body1 },
Tm_While { invariant = inv2 ; condition = cond2 ; body = body2 } ->
eq_tm inv1 inv2 && eq_st_term cond1 cond2 && eq_st_term body1 body2
| Tm_Par
{ pre1 = preL1 ; body1 = eL1 ; post1 = postL1 ; pre2 = preR1 ; body2 = eR1 ; post2 = postR1 },
Tm_Par { pre1 = preL2 ; body1 = eL2 ; post1 = postL2 ; pre2 = preR2 ; body2 = eR2 ; post2 = postR2 } ->
eq_tm preL1 preL2 && eq_st_term eL1 eL2 && eq_tm postL1 postL2 && eq_tm preR1 preR2 &&
eq_st_term eR1 eR2 &&
eq_tm postR1 postR2
| Tm_WithLocal { binder = x1 ; initializer = e1 ; body = b1 },
Tm_WithLocal { binder = x2 ; initializer = e2 ; body = b2 } ->
eq_tm x1.binder_ty x2.binder_ty && eq_tm e1 e2 && eq_st_term b1 b2
| Tm_WithLocalArray { binder = x1 ; initializer = e1 ; length = n1 ; body = b1 },
Tm_WithLocalArray { binder = x2 ; initializer = e2 ; length = n2 ; body = b2 } ->
eq_tm x1.binder_ty x2.binder_ty && eq_tm e1 e2 && eq_tm n1 n2 && eq_st_term b1 b2
| Tm_Rewrite { t1 = l1 ; t2 = r1 }, Tm_Rewrite { t1 = l2 ; t2 = r2 } -> eq_tm l1 l2 && eq_tm r1 r2
| Tm_Admit { ctag = c1 ; u = u1 ; typ = t1 ; post = post1 },
Tm_Admit { ctag = c2 ; u = u2 ; typ = t2 ; post = post2 } ->
c1 = c2 && eq_univ u1 u2 && eq_tm t1 t2 && eq_tm_opt post1 post2
| Tm_Unreachable, Tm_Unreachable -> true
| Tm_ProofHintWithBinders { hint_type = ht1 ; binders = bs1 ; t = t1 },
Tm_ProofHintWithBinders { hint_type = ht2 ; binders = bs2 ; t = t2 } ->
eq_hint_type ht1 ht2 && eq_list eq_binder bs1 bs2 && eq_st_term t1 t2
| Tm_WithInv { name = name1 ; returns_inv = r1 ; body = body1 },
Tm_WithInv { name = name2 ; returns_inv = r2 ; body = body2 } ->
eq_tm name1 name2 &&
eq_opt (fun (b1, r1) (b2, r2) -> eq_tm b1.binder_ty b2.binder_ty && eq_tm r1 r2) r1 r2 &&
eq_st_term body1 body2
| _ -> false | false |
FStar.UInt32.fsti | FStar.UInt32.n | val n : Prims.int | let n = 32 | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 20,
"start_col": 7,
"start_line": 20
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.int | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let n =
| 32 | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_ifElseFalse_total | val va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
not (eval_ocmp s0 ifb) /\
eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | val va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
not (eval_ocmp s0 ifb) /\
eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 138,
"start_col": 0,
"start_line": 138
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ifb: Vale.X64.Decls.ocmp ->
ct: Vale.X64.Decls.va_code ->
cf: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state
-> FStar.Pervasives.Lemma
(requires
Vale.X64.Decls.valid_ocmp ifb s0 /\ Prims.op_Negation (Vale.X64.Decls.eval_ocmp s0 ifb) /\
Vale.X64.Decls.eval_code cf
(Vale.X64.State.Mkvale_state (Mkvale_state?.vs_ok s0)
(Mkvale_state?.vs_regs s0)
Vale.X64.Decls.havoc_flags
(Mkvale_state?.vs_heap s0)
(Mkvale_state?.vs_stack s0)
(Mkvale_state?.vs_stackTaint s0))
f0
sM) (ensures Vale.X64.Decls.eval_code (Vale.X64.Machine_s.IfElse ifb ct cf) s0 f0 sM) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Lemmas.lemma_ifElseFalse_total"
] | [] | true | false | true | false | false | let va_lemma_ifElseFalse_total =
| Lemmas.lemma_ifElseFalse_total | false |
FStar.UInt32.fsti | FStar.UInt32.gt | val gt (a b: t) : Tot bool | val gt (a b: t) : Tot bool | let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 226,
"start_col": 0,
"start_line": 226
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt.gt",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | false | false | false | true | false | let gt (a b: t) : Tot bool =
| gt #n (v a) (v b) | false |
FStar.UInt32.fsti | FStar.UInt32.lt | val lt (a b: t) : Tot bool | val lt (a b: t) : Tot bool | let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 232,
"start_col": 0,
"start_line": 232
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt.lt",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | false | false | false | true | false | let lt (a b: t) : Tot bool =
| lt #n (v a) (v b) | false |
FStar.UInt32.fsti | FStar.UInt32.gte | val gte (a b: t) : Tot bool | val gte (a b: t) : Tot bool | let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 229,
"start_col": 0,
"start_line": 229
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt.gte",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | false | false | false | true | false | let gte (a b: t) : Tot bool =
| gte #n (v a) (v b) | false |
Pulse.Syntax.Base.fst | Pulse.Syntax.Base.eq_branch | val eq_branch (b1 b2: pattern & st_term) : b: bool{b <==> (b1 == b2)} | val eq_branch (b1 b2: pattern & st_term) : b: bool{b <==> (b1 == b2)} | let rec eq_st_term (t1 t2:st_term)
: b:bool { b <==> (t1 == t2) }
= match t1.term, t2.term with
| Tm_Return {expected_type=ty1; insert_eq=b1; term=t1},
Tm_Return {expected_type=ty2; insert_eq=b2; term=t2} ->
eq_tm ty1 ty2 &&
b1 = b2 &&
eq_tm t1 t2
| Tm_Abs { b=b1; q=o1; ascription=c1; body=t1 },
Tm_Abs { b=b2; q=o2; ascription=c2; body=t2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
o1=o2 &&
eq_ascription c1 c2 &&
eq_st_term t1 t2
| Tm_STApp { head=h1; arg_qual=o1; arg=t1},
Tm_STApp { head=h2; arg_qual=o2; arg=t2} ->
eq_tm h1 h2 &&
o1=o2 &&
eq_tm t1 t2
| Tm_Bind { binder=b1; head=t1; body=k1 },
Tm_Bind { binder=b2; head=t2; body=k2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
eq_st_term t1 t2 &&
eq_st_term k1 k2
| Tm_TotBind { binder=b1; head=t1; body=k1 },
Tm_TotBind { binder=b2; head=t2; body=k2 } ->
eq_tm b1.binder_ty b2.binder_ty &&
eq_tm t1 t2 &&
eq_st_term k1 k2
| Tm_IntroPure { p=p1 }, Tm_IntroPure { p=p2 } ->
eq_tm p1 p2
| Tm_IntroExists { p=p1; witnesses=l1 },
Tm_IntroExists { p=p2; witnesses=l2 } ->
eq_tm p1 p2 &&
eq_tm_list l1 l2
| Tm_ElimExists {p=p1},
Tm_ElimExists {p=p2} ->
eq_tm p1 p2
| Tm_If { b=g1; then_=ethen1; else_=eelse1; post=p1},
Tm_If { b=g2; then_=ethen2; else_=eelse2; post=p2} ->
eq_tm g1 g2 &&
eq_st_term ethen1 ethen2 &&
eq_st_term eelse1 eelse2 &&
eq_tm_opt p1 p2
| Tm_Match {sc=sc1; returns_=r1; brs=br1},
Tm_Match {sc=sc2; returns_=r2; brs=br2} ->
eq_tm sc1 sc2 &&
eq_tm_opt r1 r2 &&
eq_list_dec t1 t2 eq_branch br1 br2
| Tm_While { invariant=inv1; condition=cond1; body=body1 },
Tm_While { invariant=inv2; condition=cond2; body=body2 } ->
eq_tm inv1 inv2 &&
eq_st_term cond1 cond2 &&
eq_st_term body1 body2
| Tm_Par {pre1=preL1; body1=eL1; post1=postL1; pre2=preR1; body2=eR1; post2=postR1 },
Tm_Par {pre1=preL2; body1=eL2; post1=postL2; pre2=preR2; body2=eR2; post2=postR2 } ->
eq_tm preL1 preL2 &&
eq_st_term eL1 eL2 &&
eq_tm postL1 postL2 &&
eq_tm preR1 preR2 &&
eq_st_term eR1 eR2 &&
eq_tm postR1 postR2
| Tm_WithLocal { binder=x1; initializer=e1; body=b1 },
Tm_WithLocal { binder=x2; initializer=e2; body=b2 } ->
eq_tm x1.binder_ty x2.binder_ty &&
eq_tm e1 e2 &&
eq_st_term b1 b2
| Tm_WithLocalArray { binder=x1; initializer=e1; length=n1; body=b1 },
Tm_WithLocalArray { binder=x2; initializer=e2; length=n2; body=b2 } ->
eq_tm x1.binder_ty x2.binder_ty &&
eq_tm e1 e2 &&
eq_tm n1 n2 &&
eq_st_term b1 b2
| Tm_Rewrite { t1=l1; t2=r1 },
Tm_Rewrite { t1=l2; t2=r2 } ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Admit { ctag=c1; u=u1; typ=t1; post=post1 },
Tm_Admit { ctag=c2; u=u2; typ=t2; post=post2 } ->
c1 = c2 &&
eq_univ u1 u2 &&
eq_tm t1 t2 &&
eq_tm_opt post1 post2
| Tm_Unreachable, Tm_Unreachable -> true
| Tm_ProofHintWithBinders { hint_type=ht1; binders=bs1; t=t1 },
Tm_ProofHintWithBinders { hint_type=ht2; binders=bs2; t=t2 } ->
eq_hint_type ht1 ht2 &&
eq_list eq_binder bs1 bs2 &&
eq_st_term t1 t2
| Tm_WithInv {name=name1; returns_inv=r1; body=body1},
Tm_WithInv {name=name2; returns_inv=r2; body=body2} ->
eq_tm name1 name2 &&
eq_opt (fun (b1, r1) (b2, r2) -> eq_tm b1.binder_ty b2.binder_ty && eq_tm r1 r2)
r1 r2 &&
eq_st_term body1 body2
| _ -> false
and eq_branch (b1 b2 : pattern & st_term)
: b:bool{b <==> (b1 == b2)}
= let (p1, e1) = b1 in
let (p2, e2) = b2 in
eq_pattern p1 p2 && eq_st_term e1 e2 | {
"file_name": "lib/steel/pulse/Pulse.Syntax.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 299,
"start_col": 0,
"start_line": 179
} | (*
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.Syntax.Base
module RTB = FStar.Reflection.Typing.Builtins
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
let eq_univ (u1 u2:universe) : b:bool{b <==> u1 == u2} =
let open FStar.Reflection.V2.TermEq in
assume (faithful_univ u1);
assume (faithful_univ u2);
univ_eq_dec u1 u2
let rec eq_tm (t1 t2:term)
: Tot (b:bool { b <==> (t1 == t2) }) (decreases t1)
= match t1.t, t2.t with
| Tm_VProp, Tm_VProp
| Tm_Emp, Tm_Emp
| Tm_Inames, Tm_Inames
| Tm_EmpInames, Tm_EmpInames
| Tm_Unknown, Tm_Unknown -> true
| Tm_Star l1 r1, Tm_Star l2 r2 ->
eq_tm l1 l2 &&
eq_tm r1 r2
| Tm_Inv p1, Tm_Inv p2 ->
eq_tm p1 p2
| Tm_Pure p1, Tm_Pure p2 ->
eq_tm p1 p2
| Tm_ExistsSL u1 t1 b1, Tm_ExistsSL u2 t2 b2
| Tm_ForallSL u1 t1 b1, Tm_ForallSL u2 t2 b2 ->
eq_univ u1 u2 &&
eq_tm t1.binder_ty t2.binder_ty &&
eq_tm b1 b2
| Tm_FStar t1, Tm_FStar t2 ->
let open FStar.Reflection.V2.TermEq in
assume (faithful t1);
assume (faithful t2);
term_eq_dec t1 t2
| Tm_AddInv i1 is1, Tm_AddInv i2 is2 ->
eq_tm i1 i2 && eq_tm is1 is2
| _ -> false
let eq_st_comp (s1 s2:st_comp)
: b:bool { b <==> (s1 == s2) }
= eq_univ s1.u s2.u &&
eq_tm s1.res s2.res &&
eq_tm s1.pre s2.pre &&
eq_tm s1.post s2.post
let eq_comp (c1 c2:comp)
: b:bool { b <==> (c1 == c2) }
= match c1, c2 with
| C_Tot t1, C_Tot t2 ->
eq_tm t1 t2
| C_ST s1, C_ST s2 ->
eq_st_comp s1 s2
| C_STAtomic i1 o1 s1, C_STAtomic i2 o2 s2 ->
eq_tm i1 i2 &&
o1 = o2 &&
eq_st_comp s1 s2
| C_STGhost s1, C_STGhost s2 ->
eq_st_comp s1 s2
| _ -> false
let rec eq_list (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:list 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list f t1 t2
| _ -> false
let eq_opt (f: (x:'a -> y:'a -> b:bool { b <==> (x == y)})) (l m:option 'a)
: b:bool { b <==> (l == m) }
= match l, m with
| None, None -> true
| Some l, Some m -> f l m
| _ -> false
let eq_tm_opt (t1 t2:option term)
: b:bool { b <==> (t1 == t2) }
= eq_opt eq_tm t1 t2
let eq_comp_opt (c1 c2:option comp)
: b:bool { b <==> (c1 == c2) }
= eq_opt eq_comp c1 c2
let rec eq_list_dec top1 top2
(f: (x:'a -> y:'a{x << top1 /\ y << top2} -> b:bool { b <==> (x == y)}))
(l : list 'a{l << top1})
(m : list 'a{m << top2})
: b:bool { b <==> (l == m) }
= match l, m with
| [], [] -> true
| h1::t1, h2::t2 ->
f h1 h2 &&
eq_list_dec top1 top2 f t1 t2
| _ -> false
let eq_binder (b0 b1:binder) : b:bool { b <==> (b0 == b1) } =
eq_tm b0.binder_ty b1.binder_ty
let eq_tm_list (t1 t2:list term) = eq_list eq_tm t1 t2
// wire to Reflection.TermEq
assume val fstar_const_eq : c1:R.vconst -> c2:R.vconst -> b:bool{b <==> (c1==c2)}
let rec sealed_list_eq #a (l1 l2 : list (Sealed.sealed a))
: Lemma ((length l1 = length l2) ==> (l1 == l2))
= match l1, l2 with
| [], [] -> ()
| h1::t1, h2::t2 ->
Sealed.sealed_singl h1 h2;
sealed_list_eq t1 t2
| _ -> ()
let rec eq_pattern (p1 p2 : pattern) : b:bool{ b <==> (p1 == p2) } =
match p1, p2 with
| Pat_Cons f1 vs1,
Pat_Cons f2 vs2 ->
f1.fv_name = f2.fv_name &&
eq_list_dec p1 p2 eq_sub_pat vs1 vs2
| Pat_Constant c1, Pat_Constant c2 ->
fstar_const_eq c1 c2
| Pat_Var _ _, Pat_Var _ _ -> true
| Pat_Dot_Term to1, Pat_Dot_Term to2 -> eq_opt eq_tm to1 to2
| _ -> false
and eq_sub_pat (pb1 pb2 : pattern & bool) : b:bool{b <==> pb1 == pb2} =
let (p1, b1) = pb1 in
let (p2, b2) = pb2 in
eq_pattern p1 p2 && b1 = b2
let eq_hint_type (ht1 ht2:proof_hint_type)
: b:bool { b <==> (ht1 == ht2) }
= match ht1, ht2 with
| ASSERT { p=p1 }, ASSERT { p=p2 } ->
eq_tm p1 p2
| FOLD { names=ns1; p=p1}, FOLD { names=ns2; p=p2 }
| UNFOLD { names=ns1; p=p1}, UNFOLD { names=ns2; p=p2 } ->
eq_opt (eq_list (fun n1 n2 -> n1 = n2)) ns1 ns2 &&
eq_tm p1 p2
| RENAME { pairs=ps1; goal=p1 }, RENAME { pairs=ps2; goal=p2 } ->
eq_list (fun (x1, y1) (x2, y2) -> eq_tm x1 x2 && eq_tm y1 y2) ps1 ps2 &&
eq_opt eq_tm p1 p2
| REWRITE { t1; t2 }, REWRITE { t1=s1; t2=s2 } ->
eq_tm t1 s1 &&
eq_tm t2 s2
| WILD, WILD
| SHOW_PROOF_STATE _, SHOW_PROOF_STATE _ -> true
| _ -> false
let eq_ascription (a1 a2:comp_ascription)
: b:bool { b <==> (a1 == a2) }
= eq_opt eq_comp a1.elaborated a2.elaborated &&
eq_opt eq_comp a1.annotated a2.annotated | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Syntax.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": 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 |
b1: (Pulse.Syntax.Base.pattern * Pulse.Syntax.Base.st_term) ->
b2: (Pulse.Syntax.Base.pattern * Pulse.Syntax.Base.st_term)
-> b: Prims.bool{b <==> b1 == b2} | Prims.Tot | [
"total"
] | [
"eq_st_term",
"eq_branch"
] | [
"FStar.Pervasives.Native.tuple2",
"Pulse.Syntax.Base.pattern",
"Pulse.Syntax.Base.st_term",
"Prims.op_AmpAmp",
"Pulse.Syntax.Base.eq_pattern",
"Pulse.Syntax.Base.eq_st_term",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec eq_branch (b1 b2: pattern & st_term) : b: bool{b <==> (b1 == b2)} =
| let p1, e1 = b1 in
let p2, e2 = b2 in
eq_pattern p1 p2 && eq_st_term e1 e2 | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_ifElse_total | val va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel)
(requires True)
(ensures (fun (cond, sM, sN, f0) ->
cond == eval_ocmp s0 ifb /\
sM == {s0 with vs_flags = havoc_flags}
)) | val va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel)
(requires True)
(ensures (fun (cond, sM, sN, f0) ->
cond == eval_ocmp s0 ifb /\
sM == {s0 with vs_flags = havoc_flags}
)) | let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 53,
"end_line": 136,
"start_col": 0,
"start_line": 136
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ifb: Vale.X64.Decls.ocmp ->
ct: Vale.X64.Decls.va_code ->
cf: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state
-> Prims.Ghost
(((Prims.bool * Vale.X64.Decls.va_state) * Vale.X64.Decls.va_state) * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.lemma_ifElse_total"
] | [] | false | false | false | false | false | let va_lemma_ifElse_total =
| Lemmas.lemma_ifElse_total | false |
FStar.UInt32.fsti | FStar.UInt32.eq | val eq (a b: t) : Tot bool | val eq (a b: t) : Tot bool | let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 223,
"start_col": 0,
"start_line": 223
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt.eq",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | false | false | false | true | false | let eq (a b: t) : Tot bool =
| eq #n (v a) (v b) | false |
FStar.UInt32.fsti | FStar.UInt32.lte | val lte (a b: t) : Tot bool | val lte (a b: t) : Tot bool | let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 235,
"start_col": 0,
"start_line": 235
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt.lte",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | false | false | false | true | false | let lte (a b: t) : Tot bool =
| lte #n (v a) (v b) | false |
FStar.UInt32.fsti | FStar.UInt32.op_Plus_Hat | val op_Plus_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Plus_Hat = add | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 316,
"start_col": 7,
"start_line": 316
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.add"
] | [] | false | false | false | false | false | let op_Plus_Hat =
| add | false |
|
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.valid_taint_stack64 | val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 120,
"start_col": 0,
"start_line": 112
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = () | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.Def.Prop_s.prop0 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Prims.b2t",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Map.sel",
"Prims.op_Addition",
"Vale.Def.Prop_s.prop0"
] | [] | false | false | false | false | false | let valid_taint_stack64 ptr t stackTaint =
| Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | false |
Steel.ST.Array.Swap.fst | Steel.ST.Array.Swap.array_upd | val array_upd (#t: Type) (a: array t) : Tot (Gen.array_upd_t (array_pts_to a)) | val array_upd (#t: Type) (a: array t) : Tot (Gen.array_upd_t (array_pts_to a)) | let array_upd
(#t: Type)
(a: array t)
: Tot (Gen.array_upd_t (array_pts_to a))
= fun s n i x ->
upd a i x;
return _ | {
"file_name": "lib/steel/Steel.ST.Array.Swap.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 12,
"end_line": 26,
"start_col": 0,
"start_line": 20
} | module Steel.ST.Array.Swap
open Steel.ST.GenElim
open Steel.ST.Array // for pts_to
module Gen = Steel.ST.GenArraySwap
[@@__reduce__]
let array_pts_to (#t: Type) (a: array t) : Tot (Gen.array_pts_to_t t) =
fun s -> pts_to a full_perm (Ghost.reveal s)
inline_for_extraction
let array_index
(#t: Type)
(a: array t)
: Tot (Gen.array_index_t (array_pts_to a))
= fun s n i ->
index a i | {
"checked_file": "/",
"dependencies": [
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.fsti.checked",
"Steel.ST.Array.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Array.Swap.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.ST.Array // for pts_to",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap",
"short_module": "Gen"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"short_module": null
},
{
"abbrev": 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: Steel.ST.Array.array t -> Steel.ST.GenArraySwap.array_upd_t (Steel.ST.Array.Swap.array_pts_to a) | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Array.array",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"FStar.SizeT.t",
"Steel.ST.Util.return",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.ST.Array.pts_to",
"Steel.FractionalPermission.full_perm",
"FStar.Ghost.reveal",
"Steel.Effect.Common.vprop",
"FStar.Seq.Base.upd",
"FStar.SizeT.v",
"Prims.unit",
"Steel.ST.Array.upd",
"Steel.ST.GenArraySwap.array_upd_t",
"Steel.ST.Array.Swap.array_pts_to"
] | [] | false | false | false | false | false | let array_upd (#t: Type) (a: array t) : Tot (Gen.array_upd_t (array_pts_to a)) =
| fun s n i x ->
upd a i x;
return _ | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.store_taint_stack128 | val store_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | val store_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | let store_taint_stack128 ptr t stackTaint = BS.update_n ptr 16 stackTaint t | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 75,
"end_line": 142,
"start_col": 0,
"start_line": 142
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t
let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.PPC64LE.Memory.memtaint | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Vale.PPC64LE.Semantics_s.update_n"
] | [] | false | false | false | false | false | let store_taint_stack128 ptr t stackTaint =
| BS.update_n ptr 16 stackTaint t | false |
FStar.UInt32.fsti | FStar.UInt32.op_Plus_Question_Hat | val op_Plus_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Plus_Question_Hat = add_underspec | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 317,
"start_col": 7,
"start_line": 317
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.add_underspec"
] | [] | false | false | false | false | false | let op_Plus_Question_Hat =
| add_underspec | false |
|
FStar.UInt32.fsti | FStar.UInt32.n_minus_one | val n_minus_one : FStar.UInt32.t | let n_minus_one = uint_to_t (n - 1) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 244,
"start_col": 0,
"start_line": 244
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | FStar.UInt32.t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.uint_to_t",
"Prims.op_Subtraction",
"FStar.UInt32.n"
] | [] | false | false | false | true | false | let n_minus_one =
| uint_to_t (n - 1) | false |
|
FStar.UInt32.fsti | FStar.UInt32.op_Plus_Percent_Hat | val op_Plus_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Plus_Percent_Hat = add_mod | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 318,
"start_col": 7,
"start_line": 318
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.add_mod"
] | [] | false | false | false | false | false | let op_Plus_Percent_Hat =
| add_mod | false |
|
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.valid_taint_stack128 | val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 138,
"start_col": 0,
"start_line": 122
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.Def.Prop_s.prop0 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Prims.b2t",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Map.sel",
"Prims.op_Addition",
"Vale.Def.Prop_s.prop0"
] | [] | false | false | false | false | false | let valid_taint_stack128 ptr t stackTaint =
| Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | false |
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_whileTrue_total | val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires eval_ocmp sW b /\ valid_ocmp b sW)
(ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) | val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires eval_ocmp sW b /\ valid_ocmp b sW)
(ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) | let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 140,
"start_col": 0,
"start_line": 140
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: Vale.X64.Decls.ocmp ->
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
sW: Vale.X64.Decls.va_state ->
fW: Vale.X64.Decls.va_fuel
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.lemma_whileTrue_total"
] | [] | false | false | false | false | false | let va_lemma_whileTrue_total =
| Lemmas.lemma_whileTrue_total | false |
FStar.UInt32.fsti | FStar.UInt32.op_Subtraction_Hat | val op_Subtraction_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Subtraction_Hat = sub | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 319,
"start_col": 7,
"start_line": 319
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.sub"
] | [] | false | false | false | false | false | let op_Subtraction_Hat =
| sub | false |
|
FStar.UInt32.fsti | FStar.UInt32.op_Subtraction_Percent_Hat | val op_Subtraction_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Subtraction_Percent_Hat = sub_mod | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 321,
"start_col": 7,
"start_line": 321
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.sub_mod"
] | [] | false | false | false | false | false | let op_Subtraction_Percent_Hat =
| sub_mod | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_empty_total | val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)
(requires True)
(ensures (fun (sM, fM) ->
s0 == sM /\
eval_code (va_Block []) s0 fM sM
)) | val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)
(requires True)
(ensures (fun (sM, fM) ->
s0 == sM /\
eval_code (va_Block []) s0 fM sM
)) | let va_lemma_empty_total = Lemmas.lemma_empty_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 135,
"start_col": 0,
"start_line": 135
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s0: Vale.X64.Decls.va_state -> bN: Vale.X64.Decls.va_codes
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.lemma_empty_total"
] | [] | false | false | false | false | false | let va_lemma_empty_total =
| Lemmas.lemma_empty_total | false |
FStar.UInt32.fsti | FStar.UInt32.minus | val minus : a: FStar.UInt32.t -> FStar.UInt32.t | let minus (a:t) = add_mod (lognot a) (uint_to_t 1) | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 239,
"start_col": 0,
"start_line": 239
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> FStar.UInt32.t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"FStar.UInt32.add_mod",
"FStar.UInt32.lognot",
"FStar.UInt32.uint_to_t"
] | [] | false | false | false | true | false | let minus (a: t) =
| add_mod (lognot a) (uint_to_t 1) | false |
|
FStar.UInt32.fsti | FStar.UInt32.op_Subtraction_Question_Hat | val op_Subtraction_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Subtraction_Question_Hat = sub_underspec | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 54,
"end_line": 320,
"start_col": 7,
"start_line": 320
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.sub_underspec"
] | [] | false | false | false | false | false | let op_Subtraction_Question_Hat =
| sub_underspec | false |
|
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.lemma_free_stack_same_valid64 | val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures valid_src_stack64 ptr (free_stack64 start finish h))
[SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))] | val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures valid_src_stack64 ptr (free_stack64 start finish h))
[SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))] | let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 30,
"start_col": 0,
"start_line": 26
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start))
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack64 ptr
(Vale.PPC64LE.Stack_i.free_stack64 start finish h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack64 ptr
(Vale.PPC64LE.Stack_i.free_stack64 start finish h))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Negation",
"FStar.Set.mem",
"Vale.Lib.Set.remove_between",
"Prims.l_or",
"Prims.op_Equality",
"Prims.bool",
"Vale.Lib.Set.remove_between_reveal",
"FStar.Set.set",
"FStar.Map.domain",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | false | false | true | false | false | let lemma_free_stack_same_valid64 start finish ptr h =
| reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | false |
FStar.UInt32.fsti | FStar.UInt32.op_Star_Hat | val op_Star_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Star_Hat = mul | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 322,
"start_col": 7,
"start_line": 322
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.mul"
] | [] | false | false | false | false | false | let op_Star_Hat =
| mul | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_merge_total | val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires
Cons? b0 /\
eval_code (Cons?.hd b0) s0 f0 sM /\
eval_code (va_Block (Cons?.tl b0)) sM fM sN
)
(ensures (fun fN ->
fN == va_compute_merge_total f0 fM /\
eval_code (va_Block b0) s0 fN sN
)) | val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires
Cons? b0 /\
eval_code (Cons?.hd b0) s0 f0 sM /\
eval_code (va_Block (Cons?.tl b0)) sM fM sN
)
(ensures (fun fN ->
fN == va_compute_merge_total f0 fM /\
eval_code (va_Block b0) s0 fN sN
)) | let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 121,
"end_line": 134,
"start_col": 0,
"start_line": 134
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = () | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b0: Vale.X64.Decls.va_codes ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state ->
fM: Vale.X64.Decls.va_fuel ->
sN: Vale.X64.Decls.va_state
-> Prims.Ghost Vale.X64.Decls.va_fuel | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_codes",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.X64.Lemmas.compute_merge_total",
"Prims.unit",
"Vale.X64.Lemmas.lemma_merge_total"
] | [] | false | false | false | false | false | let va_lemma_merge_total b0 s0 f0 sM fM sN =
| Lemmas.lemma_merge_total b0 s0 f0 sM fM sN;
Lemmas.compute_merge_total f0 fM | false |
FStar.UInt32.fsti | FStar.UInt32.op_Star_Question_Hat | val op_Star_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Star_Question_Hat = mul_underspec | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 323,
"start_col": 7,
"start_line": 323
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.mul_underspec"
] | [] | false | false | false | false | false | let op_Star_Question_Hat =
| mul_underspec | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_whileFalse_total | val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires
valid_ocmp b sW /\
not (eval_ocmp sW b) /\
eval_while_inv (While b c) s0 fW sW
)
(ensures fun (s1, f1) ->
s1 == {sW with vs_flags = havoc_flags} /\
eval_code (While b c) s0 f1 s1
) | val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires
valid_ocmp b sW /\
not (eval_ocmp sW b) /\
eval_while_inv (While b c) s0 fW sW
)
(ensures fun (s1, f1) ->
s1 == {sW with vs_flags = havoc_flags} /\
eval_code (While b c) s0 f1 s1
) | let va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 141,
"start_col": 0,
"start_line": 141
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: Vale.X64.Decls.ocmp ->
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
sW: Vale.X64.Decls.va_state ->
fW: Vale.X64.Decls.va_fuel
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.lemma_whileFalse_total"
] | [] | false | false | false | false | false | let va_lemma_whileFalse_total =
| Lemmas.lemma_whileFalse_total | false |
FStar.UInt32.fsti | FStar.UInt32.op_Slash_Hat | val op_Slash_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | let op_Slash_Hat = div | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 29,
"end_line": 325,
"start_col": 7,
"start_line": 325
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.div"
] | [] | false | false | false | false | false | let op_Slash_Hat =
| div | false |
|
FStar.UInt32.fsti | FStar.UInt32.op_Star_Percent_Hat | val op_Star_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | let op_Star_Percent_Hat = mul_mod | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 324,
"start_col": 7,
"start_line": 324
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | Prims.Pure | [] | [] | [
"FStar.UInt32.mul_mod"
] | [] | false | false | false | false | false | let op_Star_Percent_Hat =
| mul_mod | false |
|
Vale.X64.Decls.fst | Vale.X64.Decls.va_lemma_whileMerge_total | val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires While? c /\ (
let cond = While?.whileCond c in
sN.vs_ok /\
valid_ocmp cond sM /\
eval_ocmp sM cond /\
eval_while_inv c s0 f0 sM /\
eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN
))
(ensures (fun fN ->
eval_while_inv c s0 fN sN
)) | val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires While? c /\ (
let cond = While?.whileCond c in
sN.vs_ok /\
valid_ocmp cond sM /\
eval_ocmp sM cond /\
eval_while_inv c s0 f0 sM /\
eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN
))
(ensures (fun fN ->
eval_while_inv c s0 fN sN
)) | let va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 142,
"start_col": 0,
"start_line": 142
} | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total | {
"checked_file": "/",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state ->
fM: Vale.X64.Decls.va_fuel ->
sN: Vale.X64.Decls.va_state
-> Prims.Ghost Vale.X64.Decls.va_fuel | Prims.Ghost | [] | [] | [
"Vale.X64.Lemmas.lemma_whileMerge_total"
] | [] | false | false | false | false | false | let va_lemma_whileMerge_total =
| Lemmas.lemma_whileMerge_total | false |
Vale.PPC64LE.Stack_i.fst | Vale.PPC64LE.Stack_i.store_taint_stack64 | val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 140,
"start_col": 0,
"start_line": 140
} | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.PPC64LE.Memory.memtaint | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Vale.PPC64LE.Semantics_s.update_n"
] | [] | false | false | false | false | false | let store_taint_stack64 ptr t stackTaint =
| BS.update_n ptr 8 stackTaint t | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.