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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_Bind_t | val wp_Bind_t : a: Type0 -> Type | let wp_Bind_t (a:Type0) = va_state -> a -> Type0 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 100,
"start_col": 0,
"start_line": 100
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | a: Type0 -> Type | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state"
] | [] | false | false | false | true | true | let wp_Bind_t (a: Type0) =
| va_state -> a -> Type0 | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_range1 | val va_range1 : FStar.Range.range | let va_range1 = mk_range "" 0 0 0 0 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 104,
"start_col": 0,
"start_line": 104
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | FStar.Range.range | Prims.Tot | [
"total"
] | [] | [
"FStar.Range.mk_range"
] | [] | false | false | false | true | false | let va_range1 =
| mk_range "" 0 0 0 0 | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_block | val wp_block
(#a: Type)
(#cs: codes)
(qcs: (va_state -> GTot (quickCodes a cs)))
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | val wp_block
(#a: Type)
(#cs: codes)
(qcs: (va_state -> GTot (quickCodes a cs)))
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 172,
"start_col": 0,
"start_line": 171
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
qcs: (_: Vale.X64.Decls.va_state -> Prims.GTot (Vale.X64.QuickCodes.quickCodes a cs)) ->
mods: Vale.X64.QuickCode.mods_t ->
s0: Vale.X64.Decls.va_state ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.QuickCodes.wp"
] | [] | false | false | false | false | true | let wp_block
(#a: Type)
(#cs: codes)
(qcs: (va_state -> GTot (quickCodes a cs)))
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 =
| wp cs (qcs s0) mods k s0 | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.k_AssertBy | val k_AssertBy : p: Type0 -> _: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0 | let k_AssertBy (p:Type0) (_:va_state) () = p | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 44,
"end_line": 101,
"start_col": 0,
"start_line": 101
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | p: Type0 -> _: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit"
] | [] | false | false | false | true | true | let k_AssertBy (p: Type0) (_: va_state) () =
| p | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_If | val wp_If
(#a: Type)
(#c1 #c2: code)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | val wp_If
(#a: Type)
(#c1 #c2: code)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k)) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 80,
"end_line": 248,
"start_col": 0,
"start_line": 243
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
b: Vale.X64.QuickCodes.cmp ->
qc1: Vale.X64.QuickCode.quickCode a c1 ->
qc2: Vale.X64.QuickCode.quickCode a c2 ->
mods: Vale.X64.QuickCode.mods_t ->
s0: Vale.X64.Decls.va_state ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCodes.cmp",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Vale.X64.QuickCodes.valid_cmp",
"Prims.b2t",
"Vale.X64.QuickCodes.mods_contains1",
"Vale.X64.QuickCode.Mod_flags",
"Prims.l_imp",
"Vale.X64.QuickCodes.eval_cmp",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.QuickCode.__proj__QProc__item__wp",
"Prims.op_Negation",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.havoc_flags"
] | [] | false | false | false | false | true | let wp_If
(#a: Type)
(#c1 #c2: code)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 =
| valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
(eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k)) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_Seq_t | val wp_Seq_t : a: Type0 -> Type | let wp_Seq_t (a:Type0) = va_state -> a -> Type0 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 99,
"start_col": 0,
"start_line": 99
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | a: Type0 -> Type | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state"
] | [] | false | false | false | true | true | let wp_Seq_t (a: Type0) =
| va_state -> a -> Type0 | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_InlineIf | val wp_InlineIf
(#a: Type)
(#c1 #c2: code)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | val wp_InlineIf
(#a: Type)
(#c1 #c2: code)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 191,
"start_col": 0,
"start_line": 188
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
b: Prims.bool ->
qc1: Vale.X64.QuickCode.quickCode a c1 ->
qc2: Vale.X64.QuickCode.quickCode a c2 ->
mods: Vale.X64.QuickCode.mods_t ->
s0: Vale.X64.Decls.va_state ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Prims.bool",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Prims.l_imp",
"Prims.b2t",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.QuickCode.__proj__QProc__item__wp",
"Prims.op_Negation"
] | [] | false | false | false | false | true | let wp_InlineIf
(#a: Type)
(#c1 #c2: code)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
(mods: mods_t)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 =
| (b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_While_body | val wp_While_body
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g1: a)
(s1: va_state)
(k: (va_state -> a -> Type0))
: Type0 | val wp_While_body
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g1: a)
(s1: va_state)
(k: (va_state -> a -> Type0))
: Type0 | let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1)) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 278,
"start_col": 0,
"start_line": 271
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
b: Vale.X64.QuickCodes.cmp ->
qc: (_: a -> Vale.X64.QuickCode.quickCode a c) ->
mods: Vale.X64.QuickCode.mods_t ->
inv: (_: Vale.X64.Decls.va_state -> _: a -> Type0) ->
dec: (_: Vale.X64.Decls.va_state -> _: a -> d) ->
g1: a ->
s1: Vale.X64.Decls.va_state ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCodes.cmp",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Vale.X64.QuickCodes.valid_cmp",
"Prims.l_imp",
"Prims.b2t",
"Vale.X64.QuickCodes.eval_cmp",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.QuickCode.__proj__QProc__item__wp",
"Vale.X64.QuickCodes.wp_While_inv",
"Prims.op_Negation",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.havoc_flags"
] | [] | false | false | false | false | true | let wp_While_body
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g1: a)
(s1: va_state)
(k: (va_state -> a -> Type0))
: Type0 =
| valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
(eval_cmp s1 b ==>
mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1)) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_While | val wp_While
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | val wp_While
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 | let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 86,
"end_line": 287,
"start_col": 0,
"start_line": 281
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1)) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
b: Vale.X64.QuickCodes.cmp ->
qc: (_: a -> Vale.X64.QuickCode.quickCode a c) ->
mods: Vale.X64.QuickCode.mods_t ->
inv: (_: Vale.X64.Decls.va_state -> _: a -> Type0) ->
dec: (_: Vale.X64.Decls.va_state -> _: a -> d) ->
g0: a ->
s0: Vale.X64.Decls.va_state ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCodes.cmp",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.QuickCodes.mods_contains1",
"Vale.X64.QuickCode.Mod_flags",
"Prims.l_Forall",
"Prims.l_imp",
"Vale.X64.QuickCodes.wp_While_body"
] | [] | false | false | false | false | true | let wp_While
(#a #d: Type)
(#c: code)
(b: cmp)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
(s0: va_state)
(k: (va_state -> a -> Type0))
: Type0 =
| inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
(forall (s1: va_state) (g1: a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.block | val block : block: Vale.X64.Decls.va_codes -> Vale.X64.Decls.va_code | let block = va_Block | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 27,
"end_line": 168,
"start_col": 7,
"start_line": 168
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | block: Vale.X64.Decls.va_codes -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_Block"
] | [] | false | false | false | true | false | let block =
| va_Block | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qAssume | val va_qAssume (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs | val va_qAssume (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs | let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 54,
"end_line": 320,
"start_col": 0,
"start_line": 319
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | r: FStar.Range.range -> msg: Prims.string -> e: Type0 -> qcs: Vale.X64.QuickCodes.quickCodes a cs
-> Vale.X64.QuickCodes.quickCodes a cs | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"FStar.Range.range",
"Prims.string",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCodes.QLemma",
"Prims.l_True",
"Prims.unit",
"Vale.X64.QuickCodes.qAssumeLemma"
] | [] | false | false | false | false | false | let va_qAssume (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs =
| QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_While_inv | val wp_While_inv
(#a #d: Type)
(#c: code)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(s1: va_state)
(g1: a)
(s2: va_state)
(g2: a)
: Type0 | val wp_While_inv
(#a #d: Type)
(#c: code)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(s1: va_state)
(g1: a)
(s2: va_state)
(g2: a)
: Type0 | let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 84,
"end_line": 268,
"start_col": 0,
"start_line": 264
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
qc: (_: a -> Vale.X64.QuickCode.quickCode a c) ->
mods: Vale.X64.QuickCode.mods_t ->
inv: (_: Vale.X64.Decls.va_state -> _: a -> Type0) ->
dec: (_: Vale.X64.Decls.va_state -> _: a -> d) ->
s1: Vale.X64.Decls.va_state ->
g1: a ->
s2: Vale.X64.Decls.va_state ->
g2: a
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.State.__proj__Mkvale_state__item__vs_ok",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Prims.precedes"
] | [] | false | false | false | false | true | let wp_While_inv
(#a #d: Type)
(#c: code)
(qc: (a -> quickCode a c))
(mods: mods_t)
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(s1: va_state)
(g1: a)
(s2: va_state)
(g2: a)
: Type0 =
| s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1 | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.mods_contains1 | val mods_contains1 (allowed: mods_t) (found: mod_t) : bool | val mods_contains1 (allowed: mods_t) (found: mod_t) : bool | let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 41,
"start_col": 0,
"start_line": 38
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | allowed: Vale.X64.QuickCode.mods_t -> found: Vale.X64.QuickCode.mod_t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.mods_t",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.mod_eq",
"Vale.X64.QuickCode.Mod_None",
"Prims.list",
"Prims.op_BarBar",
"Vale.X64.QuickCodes.mods_contains1",
"Prims.bool"
] | [
"recursion"
] | false | false | false | true | false | let rec mods_contains1 (allowed: mods_t) (found: mod_t) : bool =
| match allowed with
| [] -> mod_eq Mod_None found
| h :: t -> mod_eq h found || mods_contains1 t found | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.tAssumeLemma | val tAssumeLemma : p: Type0 -> Type0 | let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 315,
"start_col": 0,
"start_line": 315
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | p: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | false | true | true | let tAssumeLemma (p: Type0) =
| unit -> Lemma (requires True) (ensures p) | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qAssertSquash | val va_qAssertSquash
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(e: Type0)
(qcs: (squash e -> GTot (quickCodes a cs)))
: quickCodes a ((Block []) :: cs) | val va_qAssertSquash
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(e: Type0)
(qcs: (squash e -> GTot (quickCodes a cs)))
: quickCodes a ((Block []) :: cs) | let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 329,
"start_col": 0,
"start_line": 326
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
r: FStar.Range.range ->
msg: Prims.string ->
e: Type0 ->
qcs: (_: Prims.squash e -> Prims.GTot (Vale.X64.QuickCodes.quickCodes a cs))
-> Vale.X64.QuickCodes.quickCodes a (Vale.X64.Machine_s.Block [] :: cs) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"FStar.Range.range",
"Prims.string",
"Prims.squash",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCodes.QGhost",
"Prims.unit",
"Vale.X64.QuickCodes.qAssertSquashLemma",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.Machine_s.Block",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Prims.Nil",
"Vale.X64.Machine_s.precode"
] | [] | false | false | false | false | false | let va_qAssertSquash
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(e: Type0)
(qcs: (squash e -> GTot (quickCodes a cs)))
: quickCodes a ((Block []) :: cs) =
| QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.mods_contains | val mods_contains (allowed found: mods_t) : bool | val mods_contains (allowed found: mods_t) : bool | let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 47,
"start_col": 0,
"start_line": 44
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | allowed: Vale.X64.QuickCode.mods_t -> found: Vale.X64.QuickCode.mods_t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.mods_t",
"Vale.X64.QuickCode.mod_t",
"Prims.list",
"Prims.op_AmpAmp",
"Vale.X64.QuickCodes.mods_contains1",
"Vale.X64.QuickCodes.mods_contains",
"Prims.bool"
] | [
"recursion"
] | false | false | false | true | false | let rec mods_contains (allowed found: mods_t) : bool =
| match found with
| [] -> true
| h :: t -> mods_contains1 allowed h && mods_contains allowed t | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.tAssertLemma | val tAssertLemma : p: Type0 -> Type0 | let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 308,
"start_col": 0,
"start_line": 308
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | p: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | false | true | true | let tAssertLemma (p: Type0) =
| unit -> Lemma (requires p) (ensures p) | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qAssert | val va_qAssert (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs | val va_qAssert (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs | let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 313,
"start_col": 0,
"start_line": 312
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | r: FStar.Range.range -> msg: Prims.string -> e: Type0 -> qcs: Vale.X64.QuickCodes.quickCodes a cs
-> Vale.X64.QuickCodes.quickCodes a cs | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"FStar.Range.range",
"Prims.string",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCodes.QLemma",
"Prims.unit",
"Vale.X64.QuickCodes.qAssertLemma"
] | [] | false | false | false | false | false | let va_qAssert (#a: Type) (#cs: codes) (r: range) (msg: string) (e: Type0) (qcs: quickCodes a cs)
: quickCodes a cs =
| QLemma r msg e (fun () -> e) (qAssertLemma e) qcs | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.label | val label (r: range) (msg: string) (p: Type0)
: Ghost Type (requires True) (ensures fun q -> q <==> p) | val label (r: range) (msg: string) (p: Type0)
: Ghost Type (requires True) (ensures fun q -> q <==> p) | let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 27,
"start_col": 0,
"start_line": 25
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted: | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | r: FStar.Range.range -> msg: Prims.string -> p: Type0 -> Prims.Ghost Type0 | Prims.Ghost | [] | [] | [
"FStar.Range.range",
"Prims.string",
"Vale.X64.QuickCodes.labeled_wrap",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.l_iff",
"Prims.l_True"
] | [] | false | false | false | false | true | let label (r: range) (msg: string) (p: Type0)
: Ghost Type (requires True) (ensures fun q -> q <==> p) =
| assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.state_match | val state_match (s0 s1: va_state) : Type0 | val state_match (s0 s1: va_state) : Type0 | let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 373,
"start_col": 0,
"start_line": 367
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | s0: Vale.X64.Decls.va_state -> s1: Vale.X64.Decls.va_state -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Prims.eq2",
"Prims.bool",
"Vale.X64.State.__proj__Mkvale_state__item__vs_ok",
"Vale.X64.QuickCodes.all_regs_match",
"Vale.X64.State.__proj__Mkvale_state__item__vs_regs",
"Vale.X64.Flags.t",
"Vale.X64.State.__proj__Mkvale_state__item__vs_flags",
"Vale.X64.Memory.vale_full_heap",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Vale.X64.Stack_i.vale_stack",
"Vale.X64.State.__proj__Mkvale_state__item__vs_stack",
"Vale.X64.Memory.memtaint",
"Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint"
] | [] | false | false | false | true | true | let state_match (s0 s1: va_state) : Type0 =
| s0.vs_ok == s1.vs_ok /\ all_regs_match s0.vs_regs s1.vs_regs /\ s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\ s0.vs_stack == s1.vs_stack /\ s0.vs_stackTaint == s1.vs_stackTaint | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.normal_steps | val normal_steps:list string | val normal_steps:list string | let normal_steps : list string =
[
`%Mkvale_state?.vs_ok;
`%Mkvale_state?.vs_regs;
`%Mkvale_state?.vs_flags;
`%Mkvale_state?.vs_heap;
`%Mkvale_state?.vs_stack;
`%Mkvale_state?.vs_stackTaint;
`%Mkvale_full_heap?.vf_layout;
`%Mkvale_full_heap?.vf_heap;
`%Mkvale_full_heap?.vf_heaplets;
`%QProc?.wp;
`%QProc?.mods;
`%OConst?;
`%OReg?;
`%OMem?;
`%OStack?;
`%FStar.FunctionalExtensionality.on_dom;
] | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 439,
"start_col": 7,
"start_line": 421
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files
[@va_qattr]
let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint
val lemma_state_match (s0:va_state) (s1:va_state) : Lemma
(requires state_match s0 s1)
(ensures state_eq s0 s1)
[@va_qattr]
let va_state_match (s0:va_state) (s1:va_state) : Pure Type0
(requires True)
(ensures fun b -> b ==> state_eq s0 s1)
=
FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1
[@va_qattr]
unfold let wp_sound_code_pre (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) : Type0 =
forall
(ok:bool)
(regs:Regs.t)
(flags:Flags.t)
//(mem:vale_full_heap) // splitting mem into its components makes the VCs slightly cleaner:
(mem_layout:vale_heap_layout)
(mem_heap:vale_heap)
(mem_heaplets:vale_heaplets)
(stack:vale_stack)
(stackTaint:memtaint)
.
let mem = {
vf_layout = mem_layout;
vf_heap = mem_heap;
vf_heaplets = mem_heaplets;
} in
let s0' = {
vs_ok = ok;
vs_regs = regs;
vs_flags = flags;
vs_heap = mem;
vs_stack = stack;
vs_stackTaint = stackTaint
} in
s0 == s0' ==> QProc?.wp qc (state_eta s0') (k (state_eta s0'))
unfold let wp_sound_code_post (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) ((sN:va_state), (fN:fuel), (gN:a)) : Type0 =
eval c s0 fN sN /\
update_state_mods qc.mods sN s0 == sN /\
state_inv sN /\
k s0 sN gN | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let normal_steps:list string =
| [
`%Mkvale_state?.vs_ok; `%Mkvale_state?.vs_regs; `%Mkvale_state?.vs_flags; `%Mkvale_state?.vs_heap;
`%Mkvale_state?.vs_stack; `%Mkvale_state?.vs_stackTaint; `%Mkvale_full_heap?.vf_layout;
`%Mkvale_full_heap?.vf_heap; `%Mkvale_full_heap?.vf_heaplets; `%QProc?.wp; `%QProc?.mods;
`%OConst?; `%OReg?; `%OMem?; `%OStack?; `%FStar.FunctionalExtensionality.on_dom
] | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qAssertBy | val va_qAssertBy
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(p: Type0)
(qcsBy: quickCodes unit [])
(qcsTail: quickCodes a cs)
: quickCodes a cs | val va_qAssertBy
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(p: Type0)
(qcsBy: quickCodes unit [])
(qcsTail: quickCodes a cs)
: quickCodes a cs | let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 341,
"start_col": 0,
"start_line": 340
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
r: FStar.Range.range ->
msg: Prims.string ->
p: Type0 ->
qcsBy: Vale.X64.QuickCodes.quickCodes Prims.unit [] ->
qcsTail: Vale.X64.QuickCodes.quickCodes a cs
-> Vale.X64.QuickCodes.quickCodes a cs | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"FStar.Range.range",
"Prims.string",
"Vale.X64.QuickCodes.quickCodes",
"Prims.unit",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.QuickCodes.QAssertBy"
] | [] | false | false | false | false | false | let va_qAssertBy
(#a: Type)
(#cs: codes)
(r: range)
(msg: string)
(p: Type0)
(qcsBy: quickCodes unit [])
(qcsTail: quickCodes a cs)
: quickCodes a cs =
| QAssertBy r msg p qcsBy qcsTail | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.tAssertSquashLemma | val tAssertSquashLemma : p: Type0 -> Type0 | let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 94,
"end_line": 322,
"start_col": 0,
"start_line": 322
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | p: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Prims.squash"
] | [] | false | false | false | true | true | let tAssertSquashLemma (p: Type0) =
| unit -> Ghost (squash p) (requires p) (ensures fun () -> p) | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_sound_code_post | val wp_sound_code_post : qc: Vale.X64.QuickCode.quickCode a c ->
s0: Vale.X64.Decls.va_state ->
k: (s0': Vale.X64.Decls.va_state{s0 == s0'} -> _: Vale.X64.Decls.va_state -> _: a -> Type0) ->
_: ((Vale.X64.State.vale_state * Vale.X64.Decls.va_fuel) * a)
-> Type0 | let wp_sound_code_post (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) ((sN:va_state), (fN:fuel), (gN:a)) : Type0 =
eval c s0 fN sN /\
update_state_mods qc.mods sN s0 == sN /\
state_inv sN /\
k s0 sN gN | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 12,
"end_line": 419,
"start_col": 7,
"start_line": 415
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files
[@va_qattr]
let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint
val lemma_state_match (s0:va_state) (s1:va_state) : Lemma
(requires state_match s0 s1)
(ensures state_eq s0 s1)
[@va_qattr]
let va_state_match (s0:va_state) (s1:va_state) : Pure Type0
(requires True)
(ensures fun b -> b ==> state_eq s0 s1)
=
FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1
[@va_qattr]
unfold let wp_sound_code_pre (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) : Type0 =
forall
(ok:bool)
(regs:Regs.t)
(flags:Flags.t)
//(mem:vale_full_heap) // splitting mem into its components makes the VCs slightly cleaner:
(mem_layout:vale_heap_layout)
(mem_heap:vale_heap)
(mem_heaplets:vale_heaplets)
(stack:vale_stack)
(stackTaint:memtaint)
.
let mem = {
vf_layout = mem_layout;
vf_heap = mem_heap;
vf_heaplets = mem_heaplets;
} in
let s0' = {
vs_ok = ok;
vs_regs = regs;
vs_flags = flags;
vs_heap = mem;
vs_stack = stack;
vs_stackTaint = stackTaint
} in
s0 == s0' ==> QProc?.wp qc (state_eta s0') (k (state_eta s0')) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
qc: Vale.X64.QuickCode.quickCode a c ->
s0: Vale.X64.Decls.va_state ->
k: (s0': Vale.X64.Decls.va_state{s0 == s0'} -> _: Vale.X64.Decls.va_state -> _: a -> Type0) ->
_: ((Vale.X64.State.vale_state * Vale.X64.Decls.va_fuel) * a)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.Decls.va_state",
"Prims.eq2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_fuel",
"Prims.l_and",
"Vale.X64.QuickCodes.eval",
"Vale.X64.QuickCode.update_state_mods",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.Decls.state_inv"
] | [] | false | false | false | false | true | let wp_sound_code_post
(#a: Type0)
(#c: code)
(qc: quickCode a c)
(s0: va_state)
(k: (s0': va_state{s0 == s0'} -> va_state -> a -> Type0))
((sN: va_state), (fN: fuel), (gN: a))
: Type0 =
| eval c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k s0 sN gN | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.normal | val normal (x: Type0) : Type0 | val normal (x: Type0) : Type0 | let normal (x:Type0) : Type0 = norm [nbe; iota; zeta; simplify; primops; delta_attr [`%va_qattr]; delta_only normal_steps] x | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 131,
"end_line": 441,
"start_col": 7,
"start_line": 441
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files
[@va_qattr]
let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint
val lemma_state_match (s0:va_state) (s1:va_state) : Lemma
(requires state_match s0 s1)
(ensures state_eq s0 s1)
[@va_qattr]
let va_state_match (s0:va_state) (s1:va_state) : Pure Type0
(requires True)
(ensures fun b -> b ==> state_eq s0 s1)
=
FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1
[@va_qattr]
unfold let wp_sound_code_pre (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) : Type0 =
forall
(ok:bool)
(regs:Regs.t)
(flags:Flags.t)
//(mem:vale_full_heap) // splitting mem into its components makes the VCs slightly cleaner:
(mem_layout:vale_heap_layout)
(mem_heap:vale_heap)
(mem_heaplets:vale_heaplets)
(stack:vale_stack)
(stackTaint:memtaint)
.
let mem = {
vf_layout = mem_layout;
vf_heap = mem_heap;
vf_heaplets = mem_heaplets;
} in
let s0' = {
vs_ok = ok;
vs_regs = regs;
vs_flags = flags;
vs_heap = mem;
vs_stack = stack;
vs_stackTaint = stackTaint
} in
s0 == s0' ==> QProc?.wp qc (state_eta s0') (k (state_eta s0'))
unfold let wp_sound_code_post (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) ((sN:va_state), (fN:fuel), (gN:a)) : Type0 =
eval c s0 fN sN /\
update_state_mods qc.mods sN s0 == sN /\
state_inv sN /\
k s0 sN gN
unfold let normal_steps : list string =
[
`%Mkvale_state?.vs_ok;
`%Mkvale_state?.vs_regs;
`%Mkvale_state?.vs_flags;
`%Mkvale_state?.vs_heap;
`%Mkvale_state?.vs_stack;
`%Mkvale_state?.vs_stackTaint;
`%Mkvale_full_heap?.vf_layout;
`%Mkvale_full_heap?.vf_heap;
`%Mkvale_full_heap?.vf_heaplets;
`%QProc?.wp;
`%QProc?.mods;
`%OConst?;
`%OReg?;
`%OMem?;
`%OStack?;
`%FStar.FunctionalExtensionality.on_dom;
] | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | x: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.nbe",
"FStar.Pervasives.iota",
"FStar.Pervasives.zeta",
"FStar.Pervasives.simplify",
"FStar.Pervasives.primops",
"FStar.Pervasives.delta_attr",
"Prims.string",
"Prims.Nil",
"FStar.Pervasives.delta_only",
"Vale.X64.QuickCodes.normal_steps"
] | [] | false | false | false | true | true | let normal (x: Type0) : Type0 =
| norm [nbe; iota; zeta; simplify; primops; delta_attr [`%va_qattr]; delta_only normal_steps] x | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qPURE | val va_qPURE
(#cs: codes)
(#pre: ((unit -> GTot Type0) -> GTot Type0){is_monotonic pre})
(#a: Type0)
(r: range)
(msg: string)
($l:
(unit
-> PURE unit
(intro_pure_wp_monotonicity pre;
pre)))
(qcs: quickCodes a cs)
: quickCodes a cs | val va_qPURE
(#cs: codes)
(#pre: ((unit -> GTot Type0) -> GTot Type0){is_monotonic pre})
(#a: Type0)
(r: range)
(msg: string)
($l:
(unit
-> PURE unit
(intro_pure_wp_monotonicity pre;
pre)))
(qcs: quickCodes a cs)
: quickCodes a cs | let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 82,
"start_col": 0,
"start_line": 78
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
r: FStar.Range.range ->
msg: Prims.string ->
$l: (_: Prims.unit -> Prims.PURE Prims.unit) ->
qcs: Vale.X64.QuickCodes.quickCodes a cs
-> Vale.X64.QuickCodes.quickCodes a cs | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"Prims.unit",
"FStar.Monotonic.Pure.is_monotonic",
"FStar.Range.range",
"Prims.string",
"FStar.Monotonic.Pure.intro_pure_wp_monotonicity",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCodes.QPURE"
] | [] | false | false | false | false | false | let va_qPURE
(#cs: codes)
(#pre: ((unit -> GTot Type0) -> GTot Type0){is_monotonic pre})
(#a: Type0)
(r: range)
(msg: string)
($l:
(unit
-> PURE unit
(intro_pure_wp_monotonicity pre;
pre)))
(qcs: quickCodes a cs)
: quickCodes a cs =
| QPURE r msg pre l qcs | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_QLemma | val va_QLemma
(#a: Type0)
(#cs: codes)
(r: range)
(msg: string)
(pre: Type0)
(post: (squash pre -> Type0))
(l: (unit -> Lemma (requires pre) (ensures post ())))
(qcs: quickCodes a cs)
: quickCodes a cs | val va_QLemma
(#a: Type0)
(#cs: codes)
(r: range)
(msg: string)
(pre: Type0)
(post: (squash pre -> Type0))
(l: (unit -> Lemma (requires pre) (ensures post ())))
(qcs: quickCodes a cs)
: quickCodes a cs | let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 240,
"end_line": 74,
"start_col": 19,
"start_line": 74
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
r: FStar.Range.range ->
msg: Prims.string ->
pre: Type0 ->
post: (_: Prims.squash pre -> Type0) ->
l: (_: Prims.unit -> FStar.Pervasives.Lemma (requires pre) (ensures post ())) ->
qcs: Vale.X64.QuickCodes.quickCodes a cs
-> Vale.X64.QuickCodes.quickCodes a cs | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"FStar.Range.range",
"Prims.string",
"Prims.squash",
"Prims.unit",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCodes.QLemma"
] | [] | false | false | false | false | false | let va_QLemma
(#a: Type0)
(#cs: codes)
(r: range)
(msg: string)
(pre: Type0)
(post: (squash pre -> Type0))
(l: (unit -> Lemma (requires pre) (ensures post ())))
(qcs: quickCodes a cs)
: quickCodes a cs =
| QLemma r msg pre post l qcs | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.qblock | val qblock (#a: Type) (#cs: codes) (mods: mods_t) (qcs: (va_state -> GTot (quickCodes a cs)))
: quickCode a (block cs) | val qblock (#a: Type) (#cs: codes) (mods: mods_t) (qcs: (va_state -> GTot (quickCodes a cs)))
: quickCode a (block cs) | let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 183,
"start_col": 0,
"start_line": 182
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
mods: Vale.X64.QuickCode.mods_t ->
qcs: (_: Vale.X64.Decls.va_state -> Prims.GTot (Vale.X64.QuickCodes.quickCodes a cs))
-> Vale.X64.QuickCode.quickCode a (Vale.X64.QuickCodes.block cs) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.codes",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCode.QProc",
"Vale.X64.QuickCodes.block",
"Vale.X64.QuickCodes.wp_block",
"Vale.X64.QuickCodes.qblock_proof",
"Vale.X64.QuickCode.quickCode"
] | [] | false | false | false | false | false | let qblock (#a: Type) (#cs: codes) (mods: mods_t) (qcs: (va_state -> GTot (quickCodes a cs)))
: quickCode a (block cs) =
| QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qInlineIf | val va_qInlineIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (if_code b c1 c2) | val va_qInlineIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (if_code b c1 c2) | let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 202,
"start_col": 0,
"start_line": 201
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
mods: Vale.X64.QuickCode.mods_t ->
b: Prims.bool ->
qc1: Vale.X64.QuickCode.quickCode a c1 ->
qc2: Vale.X64.QuickCode.quickCode a c2
-> Vale.X64.QuickCode.quickCode a (Vale.X64.QuickCodes.if_code b c1 c2) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.mods_t",
"Prims.bool",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.QProc",
"Vale.X64.QuickCodes.if_code",
"Vale.X64.QuickCodes.wp_InlineIf",
"Vale.X64.QuickCodes.qInlineIf_proof"
] | [] | false | false | false | false | false | let va_qInlineIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: bool)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (if_code b c1 c2) =
| QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qIf | val va_qIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (IfElse (cmp_to_ocmp b) c1 c2) | val va_qIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (IfElse (cmp_to_ocmp b) c1 c2) | let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 93,
"end_line": 259,
"start_col": 0,
"start_line": 258
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
mods: Vale.X64.QuickCode.mods_t ->
b: Vale.X64.QuickCodes.cmp ->
qc1: Vale.X64.QuickCode.quickCode a c1 ->
qc2: Vale.X64.QuickCode.quickCode a c2
-> Vale.X64.QuickCode.quickCode a
(Vale.X64.Machine_s.IfElse (Vale.X64.QuickCodes.cmp_to_ocmp b) c1 c2) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.QuickCodes.cmp",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.QuickCode.QProc",
"Vale.X64.Machine_s.IfElse",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.QuickCodes.cmp_to_ocmp",
"Vale.X64.QuickCodes.wp_If",
"Vale.X64.QuickCodes.qIf_proof"
] | [] | false | false | false | false | false | let va_qIf
(#a: Type)
(#c1 #c2: code)
(mods: mods_t)
(b: cmp)
(qc1: quickCode a c1)
(qc2: quickCode a c2)
: quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
| QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_qWhile | val va_qWhile
(#a #d: Type)
(#c: code)
(mods: mods_t)
(b: cmp)
(qc: (a -> quickCode a c))
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
: quickCode a (While (cmp_to_ocmp b) c) | val va_qWhile
(#a #d: Type)
(#c: code)
(mods: mods_t)
(b: cmp)
(qc: (a -> quickCode a c))
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
: quickCode a (While (cmp_to_ocmp b) c) | let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 304,
"start_col": 0,
"start_line": 299
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
mods: Vale.X64.QuickCode.mods_t ->
b: Vale.X64.QuickCodes.cmp ->
qc: (_: a -> Vale.X64.QuickCode.quickCode a c) ->
inv: (_: Vale.X64.Decls.va_state -> _: a -> Type0) ->
dec: (_: Vale.X64.Decls.va_state -> _: a -> d) ->
g0: a
-> Vale.X64.QuickCode.quickCode a (Vale.X64.Machine_s.While (Vale.X64.QuickCodes.cmp_to_ocmp b) c) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.QuickCodes.cmp",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCode.QProc",
"Vale.X64.Machine_s.While",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.QuickCodes.cmp_to_ocmp",
"Vale.X64.QuickCodes.wp_While",
"Vale.X64.QuickCodes.qWhile_proof"
] | [] | false | false | false | false | false | let va_qWhile
(#a #d: Type)
(#c: code)
(mods: mods_t)
(b: cmp)
(qc: (a -> quickCode a c))
(inv: (va_state -> a -> Type0))
(dec: (va_state -> a -> d))
(g0: a)
: quickCode a (While (cmp_to_ocmp b) c) =
| QProc (While (cmp_to_ocmp b) c)
mods
(wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.eval_cmp | val eval_cmp (s: va_state) (c: cmp) : GTot bool | val eval_cmp (s: va_state) (c: cmp) : GTot bool | let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 60,
"end_line": 240,
"start_col": 0,
"start_line": 233
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | s: Vale.X64.Decls.va_state -> c: Vale.X64.QuickCodes.cmp -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.cmp",
"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",
"Prims.op_Equality",
"Vale.Def.Types_s.nat64",
"Vale.X64.Decls.va_eval_opr64",
"Prims.op_disEquality",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"Prims.op_GreaterThan",
"Prims.bool"
] | [] | false | false | false | false | false | let eval_cmp (s: va_state) (c: cmp) : GTot bool =
| match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2 | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.valid_cmp | val valid_cmp (c: cmp) (s: va_state) : Type0 | val valid_cmp (c: cmp) (s: va_state) : Type0 | let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 60,
"end_line": 230,
"start_col": 0,
"start_line": 223
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | c: Vale.X64.QuickCodes.cmp -> s: Vale.X64.Decls.va_state -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.cmp",
"Vale.X64.Decls.va_state",
"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",
"Prims.l_and",
"Vale.X64.Decls.valid_operand"
] | [] | false | false | false | true | true | let valid_cmp (c: cmp) (s: va_state) : Type0 =
| match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.cmp_to_ocmp | val cmp_to_ocmp (c: cmp) : ocmp | val cmp_to_ocmp (c: cmp) : ocmp | let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 220,
"start_col": 0,
"start_line": 213
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | c: Vale.X64.QuickCodes.cmp -> Vale.X64.Decls.ocmp | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.cmp",
"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.Decls.va_cmp_eq",
"Vale.X64.Decls.va_cmp_ne",
"Vale.X64.Decls.va_cmp_le",
"Vale.X64.Decls.va_cmp_ge",
"Vale.X64.Decls.va_cmp_lt",
"Vale.X64.Decls.va_cmp_gt",
"Vale.X64.Decls.ocmp"
] | [] | false | false | false | true | false | let cmp_to_ocmp (c: cmp) : ocmp =
| match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2 | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_sound_code_pre | val wp_sound_code_pre
(#a: Type0)
(#c: code)
(qc: quickCode a c)
(s0: va_state)
(k: (s0': va_state{s0 == s0'} -> va_state -> a -> Type0))
: Type0 | val wp_sound_code_pre
(#a: Type0)
(#c: code)
(qc: quickCode a c)
(s0: va_state)
(k: (s0': va_state{s0 == s0'} -> va_state -> a -> Type0))
: Type0 | let wp_sound_code_pre (#a:Type0) (#c:code) (qc:quickCode a c) (s0:va_state) (k:(s0':va_state{s0 == s0'}) -> va_state -> a -> Type0) : Type0 =
forall
(ok:bool)
(regs:Regs.t)
(flags:Flags.t)
//(mem:vale_full_heap) // splitting mem into its components makes the VCs slightly cleaner:
(mem_layout:vale_heap_layout)
(mem_heap:vale_heap)
(mem_heaplets:vale_heaplets)
(stack:vale_stack)
(stackTaint:memtaint)
.
let mem = {
vf_layout = mem_layout;
vf_heap = mem_heap;
vf_heaplets = mem_heaplets;
} in
let s0' = {
vs_ok = ok;
vs_regs = regs;
vs_flags = flags;
vs_heap = mem;
vs_stack = stack;
vs_stackTaint = stackTaint
} in
s0 == s0' ==> QProc?.wp qc (state_eta s0') (k (state_eta s0')) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 413,
"start_col": 7,
"start_line": 388
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files
[@va_qattr]
let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint
val lemma_state_match (s0:va_state) (s1:va_state) : Lemma
(requires state_match s0 s1)
(ensures state_eq s0 s1)
[@va_qattr]
let va_state_match (s0:va_state) (s1:va_state) : Pure Type0
(requires True)
(ensures fun b -> b ==> state_eq s0 s1)
=
FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
qc: Vale.X64.QuickCode.quickCode a c ->
s0: Vale.X64.Decls.va_state ->
k: (s0': Vale.X64.Decls.va_state{s0 == s0'} -> _: Vale.X64.Decls.va_state -> _: a -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCodes.code",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.Decls.va_state",
"Prims.eq2",
"Prims.l_Forall",
"Prims.bool",
"Vale.X64.Regs.t",
"Vale.X64.Flags.t",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Vale.X64.Decls.vale_heap",
"Vale.Arch.HeapImpl.vale_heaplets",
"Vale.X64.Stack_i.vale_stack",
"Vale.X64.Memory.memtaint",
"Prims.l_imp",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.__proj__QProc__item__wp",
"Vale.X64.State.state_eta",
"Vale.X64.State.Mkvale_state",
"Vale.Arch.HeapImpl.vale_full_heap",
"Vale.Arch.HeapImpl.Mkvale_full_heap"
] | [] | false | false | false | false | true | let wp_sound_code_pre
(#a: Type0)
(#c: code)
(qc: quickCode a c)
(s0: va_state)
(k: (s0': va_state{s0 == s0'} -> va_state -> a -> Type0))
: Type0 =
| forall (ok: bool)
(regs: Regs.t)
(flags: Flags.t)
(mem_layout: vale_heap_layout)
(mem_heap: vale_heap)
(mem_heaplets: vale_heaplets)
(stack: vale_stack)
(stackTaint: memtaint).
let mem = { vf_layout = mem_layout; vf_heap = mem_heap; vf_heaplets = mem_heaplets } in
let s0' =
{
vs_ok = ok;
vs_regs = regs;
vs_flags = flags;
vs_heap = mem;
vs_stack = stack;
vs_stackTaint = stackTaint
}
in
s0 == s0' ==> QProc?.wp qc (state_eta s0') (k (state_eta s0')) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.regs_match | val regs_match (r0 r1: Regs.t) (k: nat{k <= n_reg_files}) : Type0 | val regs_match (r0 r1: Regs.t) (k: nat{k <= n_reg_files}) : Type0 | let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 360,
"start_col": 0,
"start_line": 358
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | r0: Vale.X64.Regs.t -> r1: Vale.X64.Regs.t -> k: Prims.nat{k <= Vale.X64.Machine_s.n_reg_files}
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Regs.t",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Vale.X64.Machine_s.n_reg_files",
"Prims.op_Equality",
"Prims.int",
"Prims.l_True",
"Prims.bool",
"Prims.l_and",
"Vale.X64.QuickCodes.regs_match_file",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.n_regs",
"Vale.X64.QuickCodes.regs_match"
] | [
"recursion"
] | false | false | false | false | true | let rec regs_match (r0 r1: Regs.t) (k: nat{k <= n_reg_files}) : Type0 =
| if k = 0 then True else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.regs_match_file | val regs_match_file (r0 r1: Regs.t) (rf: reg_file_id) (k: nat{k <= n_regs rf}) : Type0 | val regs_match_file (r0 r1: Regs.t) (rf: reg_file_id) (k: nat{k <= n_regs rf}) : Type0 | let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1) | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 355,
"start_col": 0,
"start_line": 351
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
r0: Vale.X64.Regs.t ->
r1: Vale.X64.Regs.t ->
rf: Vale.X64.Machine_s.reg_file_id ->
k: Prims.nat{k <= Vale.X64.Machine_s.n_regs rf}
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Regs.t",
"Vale.X64.Machine_s.reg_file_id",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Vale.X64.Machine_s.n_regs",
"Prims.op_Equality",
"Prims.int",
"Prims.l_True",
"Prims.bool",
"Prims.l_and",
"Prims.eq2",
"Vale.X64.Machine_s.t_reg",
"Vale.X64.Regs.sel",
"Vale.X64.QuickCodes.regs_match_file",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.reg",
"Vale.X64.Machine_s.Reg"
] | [
"recursion"
] | false | false | false | false | true | let rec regs_match_file (r0 r1: Regs.t) (rf: reg_file_id) (k: nat{k <= n_regs rf}) : Type0 =
| if k = 0
then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_Seq | val wp_Seq
(#a #b: Type0)
(cs: codes)
(qcs: quickCodes b cs)
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Seq_t a) (decreases %[cs;1;qcs]) | val wp_Seq
(#a #b: Type0)
(cs: codes)
(qcs: quickCodes b cs)
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Seq_t a) (decreases %[cs;1;qcs]) | let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 157,
"start_col": 0,
"start_line": 110
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
cs: Vale.X64.QuickCodes.codes ->
qcs: Vale.X64.QuickCodes.quickCodes b cs ->
mods: Vale.X64.QuickCode.mods_t ->
k: (_: Vale.X64.Decls.va_state -> _: b -> Type0)
-> Prims.Tot (Vale.X64.QuickCodes.wp_Seq_t a) | Prims.Tot | [
"total",
""
] | [
"wp",
"wp_Seq",
"wp_Bind"
] | [
"Vale.X64.QuickCodes.codes",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Vale.X64.State.vale_state",
"Prims.l_or",
"Prims.precedes",
"Prims.list",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Prims.l_and",
"Prims.op_Equals_Equals_Equals",
"Prims.int",
"Vale.X64.QuickCodes.wp",
"Vale.X64.QuickCodes.wp_Seq_t"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec wp_Seq
(#a #b: Type0)
(cs: codes)
(qcs: quickCodes b cs)
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Seq_t a) (decreases %[cs;1;qcs]) =
| let f s0 _ = wp cs qcs mods k s0 in
f | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.all_regs_match | val all_regs_match (r0 r1: Regs.t) : Type0 | val all_regs_match (r0 r1: Regs.t) : Type0 | let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 364,
"start_col": 0,
"start_line": 363
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | r0: Vale.X64.Regs.t -> r1: Vale.X64.Regs.t -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Regs.t",
"Vale.X64.QuickCodes.regs_match",
"Vale.X64.Machine_s.n_reg_files"
] | [] | false | false | false | true | true | let all_regs_match (r0 r1: Regs.t) : Type0 =
| regs_match r0 r1 n_reg_files | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.uint64 | val uint64 : Prims.eqtype | let uint64 = UInt64.t | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 21,
"end_line": 27,
"start_col": 0,
"start_line": 27
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt64.t"
] | [] | false | false | false | true | false | let uint64 =
| UInt64.t | false |
|
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp_Bind | val wp_Bind
(#a #b: Type0)
(cs: codes)
(qcs: (va_state -> a -> GTot (quickCodes b cs)))
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Bind_t a) (decreases %[cs;1;qcs]) | val wp_Bind
(#a #b: Type0)
(cs: codes)
(qcs: (va_state -> a -> GTot (quickCodes b cs)))
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Bind_t a) (decreases %[cs;1;qcs]) | let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 157,
"start_col": 0,
"start_line": 110
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
cs: Vale.X64.QuickCodes.codes ->
qcs: (_: Vale.X64.Decls.va_state -> _: a -> Prims.GTot (Vale.X64.QuickCodes.quickCodes b cs)) ->
mods: Vale.X64.QuickCode.mods_t ->
k: (_: Vale.X64.Decls.va_state -> _: b -> Type0)
-> Prims.Tot (Vale.X64.QuickCodes.wp_Bind_t a) | Prims.Tot | [
"total",
""
] | [
"wp",
"wp_Seq",
"wp_Bind"
] | [
"Vale.X64.QuickCodes.codes",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.wp",
"Vale.X64.QuickCodes.wp_Bind_t"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec wp_Bind
(#a #b: Type0)
(cs: codes)
(qcs: (va_state -> a -> GTot (quickCodes b cs)))
(mods: mods_t)
(k: (va_state -> b -> Type0))
: Tot (wp_Bind_t a) (decreases %[cs;1;qcs]) =
| let f s0 g = wp cs (qcs s0 g) mods k s0 in
f | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.wp | val wp
(#a: Type0)
(cs: codes)
(qcs: quickCodes a cs)
(mods: mods_t)
(k: (va_state -> a -> Type0))
(s0: va_state)
: Tot Type0 (decreases %[cs;0;qcs]) | val wp
(#a: Type0)
(cs: codes)
(qcs: quickCodes a cs)
(mods: mods_t)
(k: (va_state -> a -> Type0))
(s0: va_state)
: Tot Type0 (decreases %[cs;0;qcs]) | let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 157,
"start_col": 0,
"start_line": 110
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 |
cs: Vale.X64.QuickCodes.codes ->
qcs: Vale.X64.QuickCodes.quickCodes a cs ->
mods: Vale.X64.QuickCode.mods_t ->
k: (_: Vale.X64.Decls.va_state -> _: a -> Type0) ->
s0: Vale.X64.Decls.va_state
-> Prims.Tot Type0 | Prims.Tot | [
"total",
""
] | [
"wp",
"wp_Seq",
"wp_Bind"
] | [
"Vale.X64.QuickCodes.codes",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.QuickCode.mods_t",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.code",
"FStar.Range.range",
"Prims.string",
"Vale.X64.QuickCode.quickCode",
"Vale.X64.Decls.va_code",
"Prims.list",
"Vale.X64.QuickCodes.label",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.QuickCodes.mods_contains",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.X64.QuickCodes.wp_proc",
"Vale.X64.QuickCodes.wp_Seq",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.QuickCodes.wp_Bind",
"Vale.X64.QuickCodes.wp",
"Prims.unit",
"FStar.Monotonic.Pure.is_monotonic",
"FStar.Monotonic.Pure.as_pure_wp",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.guard_free",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Vale.X64.QuickCodes.k_AssertBy",
"Vale.X64.QuickCodes.empty_list_is_small"
] | [
"mutual recursion"
] | false | false | false | false | true | let rec wp
(#a: Type0)
(cs: codes)
(qcs: quickCodes a cs)
(mods: mods_t)
(k: (va_state -> a -> Type0))
(s0: va_state)
: Tot Type0 (decreases %[cs;0;qcs]) =
| match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c :: cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c :: cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c :: cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
(forall (p: (unit -> GTot Type0)).
(forall (u: unit). {:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ()) ==>
label r msg (pre p))
| QLemma r msg pre post l qcs -> label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c :: cs = cs in
label r msg pre /\ (forall (g: b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0) | false |
Vale.X64.QuickCodes.fsti | Vale.X64.QuickCodes.va_state_match | val va_state_match (s0 s1: va_state)
: Pure Type0 (requires True) (ensures fun b -> b ==> state_eq s0 s1) | val va_state_match (s0 s1: va_state)
: Pure Type0 (requires True) (ensures fun b -> b ==> state_eq s0 s1) | let va_state_match (s0:va_state) (s1:va_state) : Pure Type0
(requires True)
(ensures fun b -> b ==> state_eq s0 s1)
=
FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1 | {
"file_name": "vale/code/arch/x64/Vale.X64.QuickCodes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 385,
"start_col": 0,
"start_line": 380
} | module Vale.X64.QuickCodes
// Optimized weakest precondition generation for 'quick' procedures
open FStar.Mul
open FStar.Range
open Vale.Def.Prop_s
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let code = va_code
unfold let codes = va_codes
unfold let fuel = va_fuel
unfold let eval = eval_code
[@va_qattr "opaque_to_smt"]
let labeled_wrap (r:range) (msg:string) (p:Type0) : GTot Type0 = labeled r msg p
// REVIEW: when used inside a function definition, 'labeled' can show up in an SMT query
// as an uninterpreted function. Make a wrapper around labeled that is interpreted:
[@va_qattr "opaque_to_smt"]
let label (r:range) (msg:string) (p:Type0) : Ghost Type (requires True) (ensures fun q -> q <==> p) =
assert_norm (labeled_wrap r msg p <==> p);
labeled_wrap r msg p
val lemma_label_bool (r:range) (msg:string) (b:bool) : Lemma
(requires label r msg b)
(ensures b)
[SMTPat (label r msg b)]
// wrap "precedes" and LexCons to avoid issues with label (precedes ...)
let precedes_wrap (#a:Type) (x y:a) : GTot Type0 = precedes x y
[@va_qattr]
let rec mods_contains1 (allowed:mods_t) (found:mod_t) : bool =
match allowed with
| [] -> mod_eq Mod_None found
| h::t -> mod_eq h found || mods_contains1 t found
[@va_qattr]
let rec mods_contains (allowed:mods_t) (found:mods_t) : bool =
match found with
| [] -> true
| h::t -> mods_contains1 allowed h && mods_contains allowed t
[@va_qattr]
let if_code (b:bool) (c1:code) (c2:code) : code = if b then c1 else c2
open FStar.Monotonic.Pure
noeq type quickCodes (a:Type0) : codes -> Type =
| QEmpty: a -> quickCodes a []
| QSeq: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> quickCodes a cs -> quickCodes a (c::cs)
| QBind: #b:Type -> #c:code -> #cs:codes -> r:range -> msg:string ->
quickCode b c -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a (c::cs)
| QGetState: #cs:codes -> (va_state -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QPURE: #cs:codes -> r:range -> msg:string -> pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre} ->
(unit -> PURE unit (as_pure_wp pre)) -> quickCodes a cs -> quickCodes a cs
//| QBindPURE: #cs:codes -> b:Type -> r:range -> msg:string -> pre:((b -> GTot Type0) -> GTot Type0) ->
// (unit -> PURE b pre) -> (va_state -> b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QLemma: #cs:codes -> r:range -> msg:string -> pre:Type0 -> post:(squash pre -> Type0) ->
(unit -> Lemma (requires pre) (ensures post ())) -> quickCodes a cs -> quickCodes a cs
| QGhost: #cs:codes -> b:Type -> r:range -> msg:string -> pre:Type0 -> post:(b -> Type0) ->
(unit -> Ghost b (requires pre) (ensures post)) -> (b -> GTot (quickCodes a cs)) -> quickCodes a ((Block [])::cs)
| QAssertBy: #cs:codes -> r:range -> msg:string -> p:Type0 ->
quickCodes unit [] -> quickCodes a cs -> quickCodes a cs
[@va_qattr] unfold let va_QBind (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:va_state -> b -> GTot (quickCodes a cs)) : quickCodes a (c::cs) = QBind r msg qc qcs
[@va_qattr] unfold let va_QEmpty (#a:Type0) (v:a) : quickCodes a [] = QEmpty v
[@va_qattr] unfold let va_QLemma (#a:Type0) (#cs:codes) (r:range) (msg:string) (pre:Type0) (post:(squash pre -> Type0)) (l:unit -> Lemma (requires pre) (ensures post ())) (qcs:quickCodes a cs) : quickCodes a cs = QLemma r msg pre post l qcs
[@va_qattr] unfold let va_QSeq (#a:Type0) (#b:Type) (#c:code) (#cs:codes) (r:range) (msg:string) (qc:quickCode b c) (qcs:quickCodes a cs) : quickCodes a (c::cs) = QSeq r msg qc qcs
[@va_qattr]
let va_qPURE
(#cs:codes) (#pre:((unit -> GTot Type0) -> GTot Type0){is_monotonic pre}) (#a:Type0) (r:range) (msg:string)
($l:unit -> PURE unit (intro_pure_wp_monotonicity pre; pre)) (qcs:quickCodes a cs)
: quickCodes a cs =
QPURE r msg pre l qcs
(* REVIEW: this might be useful, but inference of pre doesn't work as well as for va_qPURE
(need to provide pre explicitly; as a result, no need to put $ on l)
[@va_qattr]
let va_qBindPURE
(#a #b:Type0) (#cs:codes) (pre:(b -> GTot Type0) -> GTot Type0) (r:range) (msg:string)
(l:unit -> PURE b pre) (qcs:va_state -> b -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QBindPURE b r msg pre l qcs
*)
[@va_qattr]
let wp_proc (#a:Type0) (c:code) (qc:quickCode a c) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
match qc with
| QProc _ _ wp _ -> wp s0 k
let wp_Seq_t (a:Type0) = va_state -> a -> Type0
let wp_Bind_t (a:Type0) = va_state -> a -> Type0
let k_AssertBy (p:Type0) (_:va_state) () = p
[@va_qattr]
let va_range1 = mk_range "" 0 0 0 0
val empty_list_is_small (#a:Type) (x:list a) : Lemma
([] #a == x \/ [] #a << x)
[@va_qattr]
let rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :
Tot Type0 (decreases %[cs; 0; qcs])
=
match qcs with
| QEmpty g -> k s0 g
| QSeq r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Seq cs qcs mods k))
| QBind r msg qc qcs ->
let c::cs = cs in
label r msg (mods_contains mods qc.mods /\ wp_proc c qc s0 (wp_Bind cs qcs mods k))
| QGetState f ->
let c::cs = cs in
wp cs (f s0) mods k s0
| QPURE r msg pre l qcs ->
// REVIEW: rather than just applying 'pre' directly to k,
// we define this in a roundabout way so that:
// - it works even if 'pre' isn't known to be monotonic
// - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)
(forall (p:unit -> GTot Type0).//{:pattern (pre p)}
(forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())
==>
label r msg (pre p))
(*
| QBindPURE b r msg pre l qcs ->
let c::cs = cs in
(forall (p:b -> GTot Type0).//{:pattern (pre p)}
(forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)
==>
label r msg (pre p))
*)
| QLemma r msg pre post l qcs ->
label r msg pre /\ (post () ==> wp cs qcs mods k s0)
| QGhost b r msg pre post l qcs ->
let c::cs = cs in
label r msg pre /\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)
| QAssertBy r msg p qcsBy qcs ->
empty_list_is_small cs;
wp [] qcsBy mods (k_AssertBy p) s0 /\ (p ==> wp cs qcs mods k s0)
// Hoist lambdas out of main definition to avoid issues with function equality
and wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])
=
let f s0 _ = wp cs qcs mods k s0 in f
and wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :
Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])
=
let f s0 g = wp cs (qcs s0 g) mods k s0 in f
val wp_sound (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp cs qcs mods k s0)
(ensures fun (sN, fN, gN) ->
eval (Block cs) s0 fN sN /\ update_state_mods mods sN s0 == sN /\ state_inv sN /\ k sN gN
)
///// Block
unfold let block = va_Block
[@va_qattr]
let wp_block (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
wp cs (qcs s0) mods k s0
val qblock_proof (#a:Type) (#cs:codes) (qcs:va_state -> GTot (quickCodes a cs)) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_block qcs mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (block cs) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let qblock (#a:Type) (#cs:codes) (mods:mods_t) (qcs:va_state -> GTot (quickCodes a cs)) : quickCode a (block cs) =
QProc (block cs) mods (wp_block qcs mods) (qblock_proof qcs mods)
///// If, InlineIf
[@va_qattr]
let wp_InlineIf (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
( b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s0 k) /\
(not b ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s0 k)
val qInlineIf_proof (#a:Type) (#c1:code) (#c2:code) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_InlineIf b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (if_code b c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qInlineIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:bool) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (if_code b c1 c2) =
QProc (if_code b c1 c2) mods (wp_InlineIf b qc1 qc2 mods) (qInlineIf_proof b qc1 qc2 mods)
noeq type cmp =
| Cmp_eq : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ne : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_le : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_ge : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_lt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
| Cmp_gt : o1:operand64{not (OMem? o1 || OStack? o1)} -> o2:operand64{not (OMem? o2 || OStack? o2)} -> cmp
[@va_qattr]
let cmp_to_ocmp (c:cmp) : ocmp =
match c with
| Cmp_eq o1 o2 -> va_cmp_eq o1 o2
| Cmp_ne o1 o2 -> va_cmp_ne o1 o2
| Cmp_le o1 o2 -> va_cmp_le o1 o2
| Cmp_ge o1 o2 -> va_cmp_ge o1 o2
| Cmp_lt o1 o2 -> va_cmp_lt o1 o2
| Cmp_gt o1 o2 -> va_cmp_gt o1 o2
[@va_qattr]
let valid_cmp (c:cmp) (s:va_state) : Type0 =
match c with
| Cmp_eq o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ne o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_le o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_ge o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_lt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
| Cmp_gt o1 o2 -> valid_operand o1 s /\ valid_operand o2 s
[@va_qattr]
let eval_cmp (s:va_state) (c:cmp) : GTot bool =
match c with
| Cmp_eq o1 o2 -> va_eval_opr64 s o1 = va_eval_opr64 s o2
| Cmp_ne o1 o2 -> va_eval_opr64 s o1 <> va_eval_opr64 s o2
| Cmp_le o1 o2 -> va_eval_opr64 s o1 <= va_eval_opr64 s o2
| Cmp_ge o1 o2 -> va_eval_opr64 s o1 >= va_eval_opr64 s o2
| Cmp_lt o1 o2 -> va_eval_opr64 s o1 < va_eval_opr64 s o2
| Cmp_gt o1 o2 -> va_eval_opr64 s o1 > va_eval_opr64 s o2
[@va_qattr]
let wp_If (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0) : Type0 =
// REVIEW: this duplicates k
valid_cmp b s0 /\ mods_contains1 mods Mod_flags /\
(let s1 = va_upd_flags havoc_flags s0 in
( eval_cmp s0 b ==> mods_contains mods qc1.mods /\ QProc?.wp qc1 s1 k) /\
(not (eval_cmp s0 b) ==> mods_contains mods qc2.mods /\ QProc?.wp qc2 s1 k))
val qIf_proof (#a:Type) (#c1:code) (#c2:code) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) (mods:mods_t) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_If b qc1 qc2 mods s0 k)
(ensures fun (sM, f0, g) ->
eval_code (IfElse (cmp_to_ocmp b) c1 c2) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qIf (#a:Type) (#c1:code) (#c2:code) (mods:mods_t) (b:cmp) (qc1:quickCode a c1) (qc2:quickCode a c2) : quickCode a (IfElse (cmp_to_ocmp b) c1 c2) =
QProc (IfElse (cmp_to_ocmp b) c1 c2) mods (wp_If b qc1 qc2 mods) (qIf_proof b qc1 qc2 mods)
///// While
[@va_qattr]
let wp_While_inv
(#a #d:Type) (#c:code) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (s1:va_state) (g1:a) (s2:va_state) (g2:a)
: Type0 =
s2.vs_ok /\ inv s2 g2 /\ mods_contains mods (qc g2).mods /\ dec s2 g2 << dec s1 g1
[@va_qattr]
let wp_While_body
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g1:a) (s1:va_state) (k:va_state -> a -> Type0)
: Type0 =
valid_cmp b s1 /\
(let s1' = va_upd_flags havoc_flags s1 in
( eval_cmp s1 b ==> mods_contains mods (qc g1).mods /\ QProc?.wp (qc g1) s1' (wp_While_inv qc mods inv dec s1 g1)) /\
(not (eval_cmp s1 b) ==> k s1' g1))
[@va_qattr]
let wp_While
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Type0 =
inv s0 g0 /\ mods_contains mods (qc g0).mods /\ mods_contains1 mods Mod_flags /\
// REVIEW: we could get a better WP with forall (...state components...) instead of forall (s1:va_state)
(forall (s1:va_state) (g1:a). inv s1 g1 ==> wp_While_body b qc mods inv dec g1 s1 k)
val qWhile_proof
(#a #d:Type) (#c:code) (b:cmp) (qc:a -> quickCode a c) (mods:mods_t) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a) (s0:va_state) (k:va_state -> a -> Type0)
: Ghost (va_state & va_fuel & a)
(requires t_require s0 /\ wp_While b qc mods inv dec g0 s0 k)
(ensures fun (sM, f0, g) ->
eval_code (While (cmp_to_ocmp b) c) s0 f0 sM /\ update_state_mods mods sM s0 == sM /\ state_inv sM /\ k sM g
)
[@"opaque_to_smt" va_qattr]
let va_qWhile
(#a #d:Type) (#c:code) (mods:mods_t) (b:cmp) (qc:a -> quickCode a c) (inv:va_state -> a -> Type0)
(dec:va_state -> a -> d) (g0:a)
: quickCode a (While (cmp_to_ocmp b) c) =
QProc (While (cmp_to_ocmp b) c) mods (wp_While b qc mods inv dec g0)
(qWhile_proof b qc mods inv dec g0)
///// Assert, Assume, AssertBy
let tAssertLemma (p:Type0) = unit -> Lemma (requires p) (ensures p)
val qAssertLemma (p:Type0) : tAssertLemma p
[@va_qattr]
let va_qAssert (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg e (fun () -> e) (qAssertLemma e) qcs
let tAssumeLemma (p:Type0) = unit -> Lemma (requires True) (ensures p)
val qAssumeLemma (p:Type0) : tAssumeLemma p
[@va_qattr]
let va_qAssume (#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:quickCodes a cs) : quickCodes a cs =
QLemma r msg True (fun () -> e) (qAssumeLemma e) qcs
let tAssertSquashLemma (p:Type0) = unit -> Ghost (squash p) (requires p) (ensures fun () -> p)
val qAssertSquashLemma (p:Type0) : tAssertSquashLemma p
[@va_qattr]
let va_qAssertSquash
(#a:Type) (#cs:codes) (r:range) (msg:string) (e:Type0) (qcs:squash e -> GTot (quickCodes a cs))
: quickCodes a ((Block [])::cs) =
QGhost (squash e) r msg e (fun () -> e) (qAssertSquashLemma e) qcs
//let tAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) =
// unit -> Lemma (requires t_require s0 /\ wp [] qcs mods (fun _ _ -> p) s0) (ensures p)
//val qAssertByLemma (#a:Type) (p:Type0) (qcs:quickCodes a []) (mods:mods_t) (s0:state) : tAssertByLemma p qcs mods s0
//
//[@va_qattr]
//let va_qAssertBy (#a:Type) (#cs:codes) (mods:mods_t) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (s0:state) (qcsTail:quickCodes a cs) : quickCodes a cs =
// QLemma r msg (t_require s0 /\ wp [] qcsBy mods (fun _ _ -> p) s0) (fun () -> p) (qAssertByLemma p qcsBy mods s0) qcsTail
[@va_qattr]
let va_qAssertBy (#a:Type) (#cs:codes) (r:range) (msg:string) (p:Type0) (qcsBy:quickCodes unit []) (qcsTail:quickCodes a cs) : quickCodes a cs =
QAssertBy r msg p qcsBy qcsTail
///// Code
val wp_sound_code (#a:Type0) (c:code) (qc:quickCode a c) (k:va_state -> a -> Type0) (s0:va_state) :
Ghost (va_state & fuel & a)
(requires t_require s0 /\ QProc?.wp qc s0 k)
(ensures fun (sN, fN, gN) -> eval_code c s0 fN sN /\ update_state_mods qc.mods sN s0 == sN /\ state_inv sN /\ k sN gN)
[@va_qattr]
let rec regs_match_file (r0:Regs.t) (r1:Regs.t) (rf:reg_file_id) (k:nat{k <= n_regs rf}) : Type0 =
if k = 0 then True
else
let r = Reg rf (k - 1) in
Regs.sel r r0 == Regs.sel r r1 /\ regs_match_file r0 r1 rf (k - 1)
[@va_qattr]
let rec regs_match (r0:Regs.t) (r1:Regs.t) (k:nat{k <= n_reg_files}) : Type0 =
if k = 0 then True
else regs_match_file r0 r1 (k - 1) (n_regs (k - 1)) /\ regs_match r0 r1 (k - 1)
[@va_qattr]
let all_regs_match (r0:Regs.t) (r1:Regs.t) : Type0 =
regs_match r0 r1 n_reg_files
[@va_qattr]
let state_match (s0:va_state) (s1:va_state) : Type0 =
s0.vs_ok == s1.vs_ok /\
all_regs_match s0.vs_regs s1.vs_regs /\
s0.vs_flags == s1.vs_flags /\
s0.vs_heap == s1.vs_heap /\
s0.vs_stack == s1.vs_stack /\
s0.vs_stackTaint == s1.vs_stackTaint
val lemma_state_match (s0:va_state) (s1:va_state) : Lemma
(requires state_match s0 s1)
(ensures state_eq s0 s1) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Regs.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.QuickCodes.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "FStar.Range",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Range",
"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": 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 | s0: Vale.X64.Decls.va_state -> s1: Vale.X64.Decls.va_state -> Prims.Pure Type0 | Prims.Pure | [] | [] | [
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.state_match",
"Prims.unit",
"FStar.Classical.move_requires",
"Vale.X64.State.state_eq",
"Vale.X64.QuickCodes.lemma_state_match",
"Prims.l_True",
"Prims.l_imp"
] | [] | false | false | false | false | true | let va_state_match (s0 s1: va_state)
: Pure Type0 (requires True) (ensures fun b -> b ==> state_eq s0 s1) =
| FStar.Classical.move_requires (lemma_state_match s0) s1;
state_match s0 s1 | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.b128 | val b128 : Type0 | let b128 = buf_t TUInt8 TUInt128 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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.Interop.Base.buf_t",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128"
] | [] | false | false | false | true | true | let b128 =
| buf_t TUInt8 TUInt128 | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.tuint64 | val tuint64 : Vale.Interop.Base.td | let tuint64 = TD_Base TUInt64 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.Interop.Base.td | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | false | false | false | true | false | let tuint64 =
| TD_Base TUInt64 | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.t128_no_mod | val t128_no_mod : Vale.Interop.Base.td | let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 106,
"end_line": 40,
"start_col": 0,
"start_line": 40
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.Interop.Base.td | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Vale.Interop.Base.Mkbuffer_qualifiers",
"Vale.Arch.HeapTypes_s.Secret"
] | [] | false | false | false | true | false | let t128_no_mod =
| TD_Buffer TUInt8 TUInt128 ({ modified = false; strict_disjointness = false; taint = MS.Secret }) | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.t128_mod | val t128_mod : Vale.Interop.Base.td | let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 38,
"start_col": 0,
"start_line": 38
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.Interop.Base.td | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Vale.Interop.Base.default_bq"
] | [] | false | false | false | true | false | let t128_mod =
| TD_Buffer TUInt8 TUInt128 default_bq | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.code_gctr128 | val code_gctr128 : Vale.X64.Decls.va_code | let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 131,
"start_col": 0,
"start_line": 131
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.X64.GCTR.va_code_Gctr_bytes_stdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128"
] | [] | false | false | false | true | false | let code_gctr128 =
| GC.va_code_Gctr_bytes_stdcall IA.win AES_128 | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.code_gctr256 | val code_gctr256 : Vale.X64.Decls.va_code | let code_gctr256 = GC.va_code_Gctr_bytes_stdcall IA.win AES_256 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 234,
"start_col": 0,
"start_line": 234
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_gctr128 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr256_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr256_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr256_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr256_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr256_pre s) (gctr256_post s)) (gctr256_lemma' s) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.X64.GCTR.va_code_Gctr_bytes_stdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256"
] | [] | false | false | false | true | false | let code_gctr256 =
| GC.va_code_Gctr_bytes_stdcall IA.win AES_256 | false |
|
FStar.BigOps.fst | FStar.BigOps.big_and'_nil | val big_and'_nil (#a: Type) (f: (a -> Type)) : Lemma (big_and' f [] == True) | val big_and'_nil (#a: Type) (f: (a -> Type)) : Lemma (big_and' f [] == True) | let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 35,
"start_col": 0,
"start_line": 34
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> FStar.Pervasives.Lemma (ensures FStar.BigOps.big_and' f [] == Prims.l_True) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.big_and'",
"Prims.Nil",
"Prims.l_True",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let big_and'_nil (#a: Type) (f: (a -> Type)) =
| FStar.Tactics.Effect.assert_by_tactic (big_and' f [] == True)
(fun _ ->
();
(T.compute ())) | false |
FStar.BigOps.fst | FStar.BigOps.big_or'_nil | val big_or'_nil (#a: Type) (f: (a -> Type)) : Lemma (big_or' f [] == False) | val big_or'_nil (#a: Type) (f: (a -> Type)) : Lemma (big_or' f [] == False) | let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 52,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> FStar.Pervasives.Lemma (ensures FStar.BigOps.big_or' f [] == Prims.l_False) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.big_or'",
"Prims.Nil",
"Prims.l_False",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let big_or'_nil (#a: Type) (f: (a -> Type)) =
| FStar.Tactics.Effect.assert_by_tactic (big_or' f [] == False)
(fun _ ->
();
(T.compute ())) | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.qas_nat4 | val qas_nat4 : f: Hacl.Spec.K256.Scalar.qelem4 -> Prims.int | let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192 | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 24,
"start_col": 0,
"start_line": 22
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4 | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Spec.K256.Scalar.qelem4 -> Prims.int | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"Lib.IntTypes.uint64",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.int"
] | [] | false | false | false | true | false | let qas_nat4 (f: qelem4) =
| let f0, f1, f2, f3 = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192 | false |
|
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.is_qelem_zero_vartime4 | val is_qelem_zero_vartime4 : _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 50,
"start_col": 0,
"start_line": 45
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"Lib.IntTypes.uint64",
"Prims.op_AmpAmp",
"Lib.IntTypes.op_Equals_Dot",
"Lib.IntTypes.U64",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Prims.bool"
] | [] | false | false | false | true | false | let is_qelem_zero_vartime4 (f0, f1, f2, f3: qelem4) : bool =
| let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL && u64_to_UInt64 f1 =. 0uL && u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL | false |
|
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.qelem4 | val qelem4 : Type0 | let qelem4 = uint64 & uint64 & uint64 & uint64 | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 17,
"start_col": 0,
"start_line": 17
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.tuple4",
"Lib.IntTypes.uint64"
] | [] | false | false | false | true | true | let qelem4 =
| uint64 & uint64 & uint64 & uint64 | false |
|
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.is_qelem_lt_pow2_128_vartime4 | val is_qelem_lt_pow2_128_vartime4 : _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | let is_qelem_lt_pow2_128_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 106,
"start_col": 0,
"start_line": 104
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end
inline_for_extraction noextract
let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3 | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"Lib.IntTypes.uint64",
"Prims.op_AmpAmp",
"Lib.IntTypes.op_Equals_Dot",
"Lib.IntTypes.U64",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Prims.bool"
] | [] | false | false | false | true | false | let is_qelem_lt_pow2_128_vartime4 (a0, a1, a2, a3: qelem4) : bool =
| let open Lib.RawIntTypes in u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL | false |
|
FStar.BigOps.fst | FStar.BigOps.big_and'_cons | val big_and'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a)
: Lemma (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) | val big_and'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a)
: Lemma (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) | let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 78,
"end_line": 38,
"start_col": 0,
"start_line": 37
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> hd: a -> tl: Prims.list a
-> FStar.Pervasives.Lemma
(ensures FStar.BigOps.big_and' f (hd :: tl) == f hd /\ FStar.BigOps.big_and' f tl) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.big_and'",
"Prims.Cons",
"Prims.l_and",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let big_and'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a) =
| FStar.Tactics.Effect.assert_by_tactic (big_and' f (hd :: tl) == (f hd /\ big_and' f tl))
(fun _ ->
();
(T.compute ())) | false |
FStar.BigOps.fst | FStar.BigOps.big_and'_prop | val big_and'_prop (#a: Type) (f: (a -> Type)) (l: list a) : Lemma ((big_and' f l) `subtype_of` unit) | val big_and'_prop (#a: Type) (f: (a -> Type)) (l: list a) : Lemma ((big_and' f l) `subtype_of` unit) | let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 43,
"start_col": 0,
"start_line": 40
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (ensures Prims.subtype_of (FStar.BigOps.big_and' f l) Prims.unit) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.big_and'_nil",
"FStar.BigOps.big_and'_cons",
"Prims.unit"
] | [] | false | false | true | false | false | let big_and'_prop (#a: Type) (f: (a -> Type)) (l: list a) =
| match l with
| [] -> big_and'_nil f
| hd :: tl -> big_and'_cons f hd tl | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.is_qelem_eq_vartime4 | val is_qelem_eq_vartime4 : _: Hacl.Spec.K256.Scalar.qelem4 -> _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3 | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 100,
"start_col": 0,
"start_line": 95
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Hacl.Spec.K256.Scalar.qelem4 -> _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple4",
"Lib.IntTypes.uint64",
"Prims.op_AmpAmp",
"Lib.IntTypes.op_Equals_Dot",
"Lib.IntTypes.U64",
"Lib.RawIntTypes.u64_to_UInt64",
"Prims.bool"
] | [] | false | false | false | true | false | let is_qelem_eq_vartime4 (a0, a1, a2, a3: qelem4) (b0, b1, b2, b3: qelem4) : bool =
| let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 && u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3 | false |
|
FStar.BigOps.fst | FStar.BigOps.pairwise_or'_nil | val pairwise_or'_nil (#a: Type) (f: (a -> a -> Type0)) : Lemma (pairwise_or' f [] == False) | val pairwise_or'_nil (#a: Type) (f: (a -> a -> Type0)) : Lemma (pairwise_or' f [] == False) | let pairwise_or'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_or' f [] == False) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 56,
"end_line": 108,
"start_col": 0,
"start_line": 107
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl
let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl
//////////////////////////////////////////////////////////////////////////////// | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0)
-> FStar.Pervasives.Lemma (ensures FStar.BigOps.pairwise_or' f [] == Prims.l_False) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.pairwise_or'",
"Prims.Nil",
"Prims.l_False",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let pairwise_or'_nil (#a: Type) (f: (a -> a -> Type0)) =
| FStar.Tactics.Effect.assert_by_tactic (pairwise_or' f [] == False)
(fun _ ->
();
(T.compute ())) | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.is_qelem_lt_q_vartime4 | val is_qelem_lt_q_vartime4 : _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 69,
"start_col": 0,
"start_line": 54
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"Lib.IntTypes.uint64",
"Lib.IntTypes.op_Less_Dot",
"Lib.IntTypes.U64",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Prims.bool",
"Lib.IntTypes.op_Greater_Dot"
] | [] | false | false | false | true | false | let is_qelem_lt_q_vartime4 (a0, a1, a2, a3: qelem4) : bool =
| let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL
then true
else
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL
then true
else
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL
then false
else
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL
then true
else
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL
then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL | false |
|
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.is_qelem_le_q_halved_vartime4 | val is_qelem_le_q_halved_vartime4 : _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 91,
"start_col": 0,
"start_line": 73
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Hacl.Spec.K256.Scalar.qelem4 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem4",
"Lib.IntTypes.uint64",
"Lib.IntTypes.op_Less_Dot",
"Lib.IntTypes.U64",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Prims.bool",
"Lib.IntTypes.op_Greater_Dot",
"Lib.IntTypes.op_Less_Equals_Dot"
] | [] | false | false | false | true | false | let is_qelem_le_q_halved_vartime4 (a0, a1, a2, a3: qelem4) : bool =
| let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL
then true
else
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL
then false
else
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL
then true
else
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL
then false
else
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL
then true
else
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL
then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL | false |
|
FStar.BigOps.fst | FStar.BigOps.pairwise_and'_nil | val pairwise_and'_nil (#a: Type) (f: (a -> a -> Type0)) : Lemma (pairwise_and' f [] == True) | val pairwise_and'_nil (#a: Type) (f: (a -> a -> Type0)) : Lemma (pairwise_and' f [] == True) | let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 56,
"end_line": 69,
"start_col": 0,
"start_line": 68
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0)
-> FStar.Pervasives.Lemma (ensures FStar.BigOps.pairwise_and' f [] == Prims.l_True) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.pairwise_and'",
"Prims.Nil",
"Prims.l_True",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let pairwise_and'_nil (#a: Type) (f: (a -> a -> Type0)) =
| FStar.Tactics.Effect.assert_by_tactic (pairwise_and' f [] == True)
(fun _ ->
();
(T.compute ())) | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_and'_cons | val pairwise_and'_cons (#a: Type) (f: (a -> a -> Type0)) (hd: a) (tl: list a)
: Lemma (pairwise_and' f (hd :: tl) == (big_and' (f hd) tl /\ pairwise_and' f tl)) | val pairwise_and'_cons (#a: Type) (f: (a -> a -> Type0)) (hd: a) (tl: list a)
: Lemma (pairwise_and' f (hd :: tl) == (big_and' (f hd) tl /\ pairwise_and' f tl)) | let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 22,
"end_line": 73,
"start_col": 0,
"start_line": 71
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> hd: a -> tl: Prims.list a
-> FStar.Pervasives.Lemma
(ensures
FStar.BigOps.pairwise_and' f (hd :: tl) ==
FStar.BigOps.big_and' (f hd) tl /\ FStar.BigOps.pairwise_and' f tl) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.pairwise_and'",
"Prims.Cons",
"Prims.l_and",
"FStar.BigOps.big_and'",
"Prims.unit",
"FStar.Tactics.V2.Derived.trefl"
] | [] | false | false | true | false | false | let pairwise_and'_cons (#a: Type) (f: (a -> a -> Type)) (hd: a) (tl: list a) =
| FStar.Tactics.Effect.assert_by_tactic (pairwise_and' f (hd :: tl) ==
(big_and' (f hd) tl /\ pairwise_and' f tl))
(fun _ ->
();
(T.trefl ())) | false |
FStar.BigOps.fst | FStar.BigOps.big_or'_prop | val big_or'_prop (#a: Type) (f: (a -> Type)) (l: list a) : Lemma ((big_or' f l) `subtype_of` unit) | val big_or'_prop (#a: Type) (f: (a -> Type)) (l: list a) : Lemma ((big_or' f l) `subtype_of` unit) | let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 60,
"start_col": 0,
"start_line": 57
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (ensures Prims.subtype_of (FStar.BigOps.big_or' f l) Prims.unit) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.big_or'_nil",
"FStar.BigOps.big_or'_cons",
"Prims.unit"
] | [] | false | false | true | false | false | let big_or'_prop (#a: Type) (f: (a -> Type)) (l: list a) =
| match l with
| [] -> big_or'_nil f
| hd :: tl -> big_or'_cons f hd tl | false |
Vale.Poly1305.X64.fst | Vale.Poly1305.X64.va_lemma_Poly1305 | val va_lemma_Poly1305 : va_b0:va_code -> va_s0:va_state -> win:bool -> ctx_b:buffer64 ->
inp_b:buffer64 -> len_in:nat64 -> finish_in:nat64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305 win) va_s0 /\ va_get_ok va_s0 /\ (let
(ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp
(va_get_stack va_s0) /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem
va_s0) /\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b
(Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\ len_in == (if
win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\ finish_in == (if win then
va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) /\ (let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\ inp_in + len_in <
pow2_64 /\ finish_in < 2))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem
va_s0) (va_get_mem va_sM) /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem
va_s0) in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =
Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read
ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem
va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =
Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192
h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq
(va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\ (finish_in == 0 ==>
h2_out < 5) /\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all
(Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\ va_get_reg64 rRsp va_sM ==
va_get_reg64 rRsp va_s0 /\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ (win
==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR15 va_sM == va_get_reg64
rR15 va_s0)) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM
(va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))) | val va_lemma_Poly1305 : va_b0:va_code -> va_s0:va_state -> win:bool -> ctx_b:buffer64 ->
inp_b:buffer64 -> len_in:nat64 -> finish_in:nat64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305 win) va_s0 /\ va_get_ok va_s0 /\ (let
(ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp
(va_get_stack va_s0) /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem
va_s0) /\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b
(Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\ len_in == (if
win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\ finish_in == (if win then
va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) /\ (let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\ inp_in + len_in <
pow2_64 /\ finish_in < 2))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem
va_s0) (va_get_mem va_sM) /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem
va_s0) in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =
Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read
ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem
va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =
Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192
h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq
(va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\ (finish_in == 0 ==>
h2_out < 5) /\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all
(Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\ va_get_reg64 rRsp va_sM ==
va_get_reg64 rRsp va_s0 /\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ (win
==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR15 va_sM == va_get_reg64
rR15 va_s0)) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM
(va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))) | let va_lemma_Poly1305 va_b0 va_s0 win ctx_b inp_b len_in finish_in =
let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet
1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;
va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Poly1305 va_mods win ctx_b inp_b len_in finish_in in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305 win) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 683 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (ctx_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->
va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0
18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
rRsi va_s0) in let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in label
va_range1
"***** POSTCONDITION NOT MET AT line 718 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 720 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 721 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 722 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 723 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r0 = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 724 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r1 = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 725 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s0 = Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 726 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s1 = Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 727 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h_in = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in)
h2_in in label va_range1
"***** POSTCONDITION NOT MET AT line 728 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in label va_range1
"***** POSTCONDITION NOT MET AT line 729 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s = Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in label va_range1
"***** POSTCONDITION NOT MET AT line 731 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_out = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 732 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 733 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 734 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h10 = Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in label va_range1
"***** POSTCONDITION NOT MET AT line 735 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h210 = Vale.Poly1305.Math.lowerUpper192 h10 h2_out in label va_range1
"***** POSTCONDITION NOT MET AT line 736 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem va_sM)
inp_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 739 column 103 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 == Vale.Poly1305.Spec_s.poly1305_hash_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n) (Vale.Poly1305.Spec_s.make_r key_r) inp_mem
(len_in `op_Division` 16)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 740 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 0 ==> h2_out < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 741 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp
h_in) key_r key_s inp_mem len_in) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 743 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 745 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 746 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 747 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 748 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 749 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 750 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 751 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 752 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0))))))))))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 1;
va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;
va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.Poly1305.X64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 2992,
"start_col": 0,
"start_line": 2905
} | module Vale.Poly1305.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.Poly1305.Spec_s
open Vale.Poly1305.Math
open Vale.Poly1305.Util
#reset-options "--z3rlimit 40"
//-- Poly1305_multiply
val va_code_Poly1305_multiply : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_multiply () =
(va_Block (va_CCons (va_code_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mul64Wrap
(va_op_opr64_reg64 rR14)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR11)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_CCons
(va_code_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rRbp)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdx)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR13)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR9)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 0)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64
rR11)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 18446744073709551612))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_CNil
()))))))))))))))))))))))))))
val va_codegen_success_Poly1305_multiply : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_multiply () =
(va_pbool_and (va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_pbool_and
(va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64
rRdx)) (va_pbool_and (va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRbp)) (va_pbool_and
(va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64
rRdx)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64
rR13)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR9)
(va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rR10) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rRbp)
(va_op_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rRax) (va_const_opr64 18446744073709551612)) (va_pbool_and (va_codegen_success_Adc64Wrap
(va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_ttrue ())))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_multiply (va_mods:va_mods_t) (r1:nat64) : (va_quickCode (int)
(va_code_Poly1305_multiply ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s) n +
va_get_reg64 rR14 va_s in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 93 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR14 va_s) r1 == va_mul_nat r1 (va_get_reg64 rR14 va_s)) (va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 94 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR11 va_s) (va_get_reg64 rR14 va_s) == va_mul_nat (va_get_reg64 rR14
va_s) (va_get_reg64 rR11 va_s)) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 95 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR11 va_s) (va_get_reg64 rRbx va_s) == va_mul_nat (va_get_reg64 rRbx
va_s) (va_get_reg64 rR11 va_s)) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 97 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR13 va_s) (va_get_reg64 rRbx va_s) == va_mul_nat (va_get_reg64 rRbx
va_s) (va_get_reg64 rR13 va_s)) (let (gd0:int) = va_mul_nat (va_get_reg64 rR14 va_s)
(va_get_reg64 rR11 va_s) + va_mul_nat (va_get_reg64 rRbx va_s) (va_get_reg64 rR13 va_s) in let
(gd1:int) = va_mul_nat (va_get_reg64 rR14 va_s) r1 + va_mul_nat (va_get_reg64 rRbx va_s)
(va_get_reg64 rR11 va_s) + va_mul_nat (va_get_reg64 rRbp va_s) (va_get_reg64 rR13 va_s) in let
(gd2:int) = va_mul_nat (va_get_reg64 rRbp va_s) (va_get_reg64 rR11 va_s) in va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 105 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.va_is_src_opr64 (Vale.X64.Decls.va_op_opr64_reg64 rR14) va_s) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 107 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 108 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 109 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 112 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 113 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 114 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 119 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 126 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 132 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 138 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 139 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 18446744073709551612)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 140 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (fun (va_s:va_state)
_ -> let (hh:int) = va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_s) + va_mul_nat n
(va_get_reg64 rRbx va_s) + va_get_reg64 rR14 va_s in let (va_arg61:Prims.int) = hh in let
(va_arg60:Prims.int) = gd2 in let (va_arg59:Prims.int) = gd1 in let (va_arg58:Prims.int) = gd0
in let (va_arg57:Prims.int) = va_get_reg64 rR13 va_s in let (va_arg56:Prims.int) = va_get_reg64
rRbp va_old_s in let (va_arg55:Prims.int) = va_get_reg64 rRbx va_old_s in let
(va_arg54:Prims.int) = va_get_reg64 rR14 va_old_s in let (va_arg53:Prims.int) = r1 in let
(va_arg52:Prims.int) = va_get_reg64 rR11 va_s in let (va_arg51:Prims.int) = h in let
(va_arg50:Prims.int) = r in let (va_arg49:Prims.int) = p in let (va_arg48:Prims.int) = n in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_multiply va_arg48 va_arg49 va_arg50 va_arg51
va_arg52 va_arg53 va_arg54 va_arg55 va_arg56 va_arg57 va_arg58 va_arg59 va_arg60 va_arg61)
(va_QEmpty ((hh))))))))))))))))))))))))))))))))))
val va_lemma_Poly1305_multiply : va_b0:va_code -> va_s0:va_state -> r1:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_multiply ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s0 in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n +
va_get_reg64 rR14 va_s0 in r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1
`op_Division` 4 /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR11 va_s0) < 7
`op_Multiply` (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rR14 va_s0) r1 < va_mul_nat n (n
`op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0) (va_get_reg64 rR11 va_s0) <
va_mul_nat n (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13
va_s0) < va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rR14 va_s0) (va_get_reg64
rR11 va_s0) < va_mul_nat n (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0)
(va_get_reg64 rR13 va_s0) < va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rRbp
va_s0) (va_get_reg64 rR13 va_s0) < 7 `op_Multiply` (5 `op_Multiply` n `op_Division` 64) /\
va_get_reg64 rRax va_s0 == r1)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p /\
va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM `op_Division`
4 < 18446744073709551616 /\ va_get_reg64 rRax va_sM == 18446744073709551612) /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok
va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_multiply va_b0 va_s0 r1 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_ok] in
let va_qc = va_qcode_Poly1305_multiply va_mods r1 in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_multiply ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 62 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
label va_range1
"***** POSTCONDITION NOT MET AT line 88 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 89 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 90 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM
`op_Division` 4 < 18446744073709551616) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 91 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == 18446744073709551612))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_multiply (r1:nat64) (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64
in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_mul_nat
(va_get_reg64 rRbp va_s0) (va_get_reg64 rR11 va_s0) < 7 `op_Multiply` (n `op_Division` 16) /\
va_mul_nat (va_get_reg64 rR14 va_s0) r1 < va_mul_nat n (n `op_Division` 16) /\ va_mul_nat
(va_get_reg64 rRbx va_s0) (va_get_reg64 rR11 va_s0) < va_mul_nat n (n `op_Division` 16) /\
va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13 va_s0) < va_mul_nat n (n `op_Division`
8) /\ va_mul_nat (va_get_reg64 rR14 va_s0) (va_get_reg64 rR11 va_s0) < va_mul_nat n (n
`op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0) (va_get_reg64 rR13 va_s0) <
va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13
va_s0) < 7 `op_Multiply` (5 `op_Multiply` n `op_Division` 64) /\ va_get_reg64 rRax va_s0 == r1)
/\ (forall (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64)
(va_x_rbp:nat64) (va_x_rax:nat64) (va_x_rdx:nat64) (va_x_efl:Vale.X64.Flags.t) (hh:int) . let
va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax
(va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14
(va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 va_s0))))))))
in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p /\
va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM `op_Division`
4 < 18446744073709551616 /\ va_get_reg64 rRax va_sM == 18446744073709551612) ==> va_k va_sM
((hh))))
val va_wpProof_Poly1305_multiply : r1:nat64 -> va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_multiply r1 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_multiply ()) ([va_Mod_flags;
va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_multiply r1 va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_multiply (va_code_Poly1305_multiply ()) va_s0 r1 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64
rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok
va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8])
va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_multiply (r1:nat64) : (va_quickCode int (va_code_Poly1305_multiply ())) =
(va_QProc (va_code_Poly1305_multiply ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8]) (va_wp_Poly1305_multiply r1) (va_wpProof_Poly1305_multiply r1))
//--
//-- Poly1305_reduce
val va_code_Poly1305_reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_reduce () =
(va_Block (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10)) (va_CCons
(va_code_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ()))))))))))
val va_codegen_success_Poly1305_reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_reduce () =
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64
rR10)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbp) (va_const_opr64 0)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_reduce (va_mods:va_mods_t) : (va_quickCode (int) (va_code_Poly1305_reduce
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (hd:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_mul_nat n n)
(va_get_reg64 rR10 va_s) + va_mul_nat n (va_get_reg64 rRbx va_s) + va_get_reg64 rR14 va_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 164 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 170 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 171 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 173 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
let (h10:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat n (va_get_reg64
rRbx va_old_s) + va_get_reg64 rR14 va_old_s in let (hh:int) = h10 + va_get_reg64 rRax va_s +
va_mul_nat (va_get_reg64 rR10 va_old_s `op_Modulus` 4) (va_mul_nat n n) in let
(va_arg27:Prims.int) = hh in let (va_arg26:Prims.int) = va_get_reg64 rRax va_s in let
(va_arg25:Prims.int) = h10 in let (va_arg24:Prims.int) = va_get_reg64 rR10 va_old_s in let
(va_arg23:Prims.int) = hd in let (va_arg22:Prims.int) = p in let (va_arg21:Prims.int) = n in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 177 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_reduce va_arg21 va_arg22 va_arg23 va_arg24
va_arg25 va_arg26 va_arg27) (va_QEmpty ((hh))))))))))))))
val va_lemma_Poly1305_reduce : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in va_get_reg64 rR10 va_s0 `op_Division` 4 `op_Multiply` 4 +
va_get_reg64 rR10 va_s0 `op_Division` 4 < n /\ va_get_reg64 rRax va_s0 ==
18446744073709551612)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) +
va_mul_nat n (va_get_reg64 rRbx va_sM) + va_get_reg64 rR14 va_sM /\ hd `op_Modulus` p == hh
`op_Modulus` p /\ va_get_reg64 rRbp va_sM < 5) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_reduce va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_reduce va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_reduce ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in label va_range1
"***** POSTCONDITION NOT MET AT line 160 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 161 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hd `op_Modulus` p == hh `op_Modulus` p) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 162 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_reduce (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in va_get_reg64 rR10 va_s0 `op_Division` 4 `op_Multiply` 4 +
va_get_reg64 rR10 va_s0 `op_Division` 4 < n /\ va_get_reg64 rRax va_s0 == 18446744073709551612)
/\ (forall (va_x_rax:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64)
(va_x_efl:Vale.X64.Flags.t) (hh:int) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp
va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (hd:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_mul_nat n n)
(va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ hd `op_Modulus` p == hh `op_Modulus` p /\ va_get_reg64 rRbp
va_sM < 5) ==> va_k va_sM ((hh))))
val va_wpProof_Poly1305_reduce : va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_reduce va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_reduce ()) ([va_Mod_flags;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_reduce va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_reduce (va_code_Poly1305_reduce ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_reduce () : (va_quickCode int (va_code_Poly1305_reduce ())) =
(va_QProc (va_code_Poly1305_reduce ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rRax]) va_wp_Poly1305_reduce
va_wpProof_Poly1305_reduce)
//--
//-- Poly1305_iteration
val va_code_Poly1305_iteration : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_iteration () =
(va_Block (va_CCons (va_code_Poly1305_multiply ()) (va_CCons (va_code_Poly1305_reduce ())
(va_CNil ()))))
val va_codegen_success_Poly1305_iteration : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_iteration () =
(va_pbool_and (va_codegen_success_Poly1305_multiply ()) (va_pbool_and
(va_codegen_success_Poly1305_reduce ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_iteration (va_mods:va_mods_t) (r1:nat64) : (va_quickCode (int)
(va_code_Poly1305_iteration ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s) n +
va_get_reg64 rR14 va_s in let (va_arg50:Prims.int) = n `op_Division` 16 in let
(va_arg49:Prims.int) = va_get_reg64 rR11 va_s in let (va_arg48:Prims.int) = va_get_reg64 rRbp
va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg48 7 va_arg49 va_arg50)
(let (va_arg47:Prims.int) = n `op_Division` 16 in let (va_arg46:Prims.int) = r1 in let
(va_arg45:Prims.int) = n in let (va_arg44:Prims.int) = va_get_reg64 rR14 va_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 211 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg44 va_arg45 va_arg46
va_arg47) (let (va_arg43:Prims.int) = n `op_Division` 16 in let (va_arg42:Prims.int) =
va_get_reg64 rR11 va_s in let (va_arg41:Prims.int) = n in let (va_arg40:Prims.int) =
va_get_reg64 rRbx va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg40 va_arg41 va_arg42
va_arg43) (let (va_arg39:Prims.int) = n `op_Division` 8 in let (va_arg38:Prims.int) =
va_get_reg64 rR13 va_s in let (va_arg37:Prims.int) = n in let (va_arg36:Prims.int) =
va_get_reg64 rRbp va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg36 va_arg37 va_arg38
va_arg39) (let (va_arg35:Prims.int) = n `op_Division` 16 in let (va_arg34:Prims.int) =
va_get_reg64 rR11 va_s in let (va_arg33:Prims.int) = n in let (va_arg32:Prims.int) =
va_get_reg64 rR14 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg32 va_arg33 va_arg34
va_arg35) (let (va_arg31:Prims.int) = n `op_Division` 8 in let (va_arg30:Prims.int) =
va_get_reg64 rR13 va_s in let (va_arg29:Prims.int) = n in let (va_arg28:Prims.int) =
va_get_reg64 rRbx va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 215 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg28 va_arg29 va_arg30
va_arg31) (let (va_arg27:Prims.int) = 5 `op_Multiply` n `op_Division` 64 in let
(va_arg26:Prims.int) = va_get_reg64 rR13 va_s in let (va_arg25:Prims.int) = va_get_reg64 rRbp
va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 216 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg25 7 va_arg26 va_arg27)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 218 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_multiply r1) (fun (va_s:va_state) (hd:int) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_reduce ()) (fun (va_s:va_state) (hh:int) -> va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 220 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 221 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(l_and (hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_s) + va_mul_nat n (va_get_reg64
rRbx va_s) + va_get_reg64 rR14 va_s) (va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p))
(va_QEmpty ((hh)))))))))))))))
val va_lemma_Poly1305_iteration : va_b0:va_code -> va_s0:va_state -> r1:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_iteration ()) va_s0 /\ va_get_ok va_s0 /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n `op_Division` 16 /\ r1 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_get_reg64 rRbp va_s0 < 7 /\
va_get_reg64 rRax va_s0 == r1)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp (va_mul_nat h r) ==
Vale.Poly1305.Spec_s.modp hh /\ va_get_reg64 rRbp va_sM < 5) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_iteration va_b0 va_s0 r1 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_ok] in
let va_qc = va_qcode_Poly1305_iteration va_mods r1 in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_iteration ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
label va_range1
"***** POSTCONDITION NOT MET AT line 200 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 201 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp (va_mul_nat h r) == Vale.Poly1305.Spec_s.modp hh) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 202 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_iteration (r1:nat64) (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n `op_Division` 16 /\ r1 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_get_reg64 rRbp va_s0 < 7 /\
va_get_reg64 rRax va_s0 == r1) /\ (forall (va_x_rax:nat64) (va_x_rdx:nat64) (va_x_r8:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64)
(va_x_efl:Vale.X64.Flags.t) (hh:int) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp
va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rRax va_x_rax va_s0)))))))) in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616
18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s0 in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n +
va_get_reg64 rR14 va_s0 in hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) +
va_mul_nat n (va_get_reg64 rRbx va_sM) + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp
(va_mul_nat h r) == Vale.Poly1305.Spec_s.modp hh /\ va_get_reg64 rRbp va_sM < 5) ==> va_k va_sM
((hh))))
val va_wpProof_Poly1305_iteration : r1:nat64 -> va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_iteration r1 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_iteration ()) ([va_Mod_flags;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_iteration r1 va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_iteration (va_code_Poly1305_iteration ()) va_s0 r1 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax])
va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_iteration (r1:nat64) : (va_quickCode int (va_code_Poly1305_iteration ())) =
(va_QProc (va_code_Poly1305_iteration ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) (va_wp_Poly1305_iteration r1) (va_wpProof_Poly1305_iteration r1))
//--
//-- Poly1305_blocks_body0
val va_code_Poly1305_blocks_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks_body0 () =
(va_Block (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64
rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Public))
(va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_CCons
(va_code_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 16))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rRcx)) (va_CCons
(va_code_Poly1305_iteration ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64
1)) (va_CNil ())))))))))))
val va_codegen_success_Poly1305_blocks_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks_body0 () =
(va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Public)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_pbool_and
(va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi)
(va_const_opr64 16)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp)
(va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Poly1305_iteration ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64 1))
(va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_ctx_b:buffer64)
(va_in_h_in:int) (va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range
18446744073709551616 18446744073709551616)) (va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) (va_in_r:int)
(va_in_h:int) (va_in_word_index:nat) : (va_quickCode (int & nat) (va_code_Poly1305_blocks_body0
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (ctx_b:buffer64) =
va_in_ctx_b in let (h_in:int) = va_in_h_in in let (inp_b:buffer64) = va_in_inp_b in let
(length:int) = va_in_length in let (n:(va_int_range 18446744073709551616 18446744073709551616))
= va_in_n in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_in_p in let (r:int) = va_in_r in let (h:int) =
va_in_h in let (word_index:nat) = va_in_word_index in let (nn:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (hp:int) = h in let (h:int) = h +
va_mul_nat (va_mul_nat nn nn) (va_get_reg64 rRcx va_s) + va_mul_nat nn
(Vale.X64.Decls.buffer64_read inp_b (word_index + 1) (va_get_mem_heaplet 0 va_s)) +
Vale.X64.Decls.buffer64_read inp_b word_index (va_get_mem_heaplet 0 va_s) in let (hq:int) = h
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 353 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 inp_b word_index
Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 353 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet
0) (va_op_reg64_reg64 rRsi) 0 Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 354 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 inp_b
(word_index + 1) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 354 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet
0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 355 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 16))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 356 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rRcx)) (fun (va_s:va_state)
_ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 358 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hq == va_mul_nat (va_get_reg64 rRbp va_s) (va_mul_nat nn nn) + va_mul_nat (va_get_reg64 rRbx
va_s) nn + va_get_reg64 rR14 va_s) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 360 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_iteration (va_get_reg64 rR12 va_s)) (fun (va_s:va_state) (h:int) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 362 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 363 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64 1)) (fun (va_s:va_state) _ -> let
(word_index:nat) = word_index + 2 in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 366 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) word_index) (let
(va_arg50:Prims.int) = word_index in let (va_arg49:(FStar.Seq.Base.seq Vale.X64.Memory.nat64))
= Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b in let (va_arg48:Prims.int)
= r in let (va_arg47:Prims.int) = va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn) in let
(va_arg46:Prims.int) = Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 368 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg46 va_arg47 va_arg48
va_arg49 va_arg50) (let (va_arg45:Prims.int) = word_index - 2 in let
(va_arg44:(FStar.Seq.Base.seq Vale.X64.Memory.nat64)) = Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s) inp_b in let (va_arg43:Prims.int) = r in let (va_arg42:Prims.int) =
va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn) in let (va_arg41:Prims.int) =
Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 369 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg41 va_arg42 va_arg43
va_arg44 va_arg45) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 370 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp) (let
(va_arg40:Prims.int) = r in let (va_arg39:Prims.int) = hq - hp in let (va_arg38:Prims.int) = hp
in let (va_arg37:Prims.pos) = p in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_demod va_arg37 va_arg38 va_arg39 va_arg40)
(va_QEmpty (())))))) (va_QEmpty ((h, word_index)))))))))))))))
val va_lemma_Poly1305_blocks_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_ctx_b:buffer64 -> va_in_h_in:int -> va_in_inp_b:buffer64 -> va_in_length:int ->
va_in_n:(va_int_range 18446744073709551616 18446744073709551616) -> va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819) -> va_in_r:int
-> va_in_h:int -> va_in_word_index:nat
-> Ghost (va_state & va_fuel & int & nat)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p ==
va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12
va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat (va_get_reg64 rRbp va_s0)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0) pow2_64 + va_get_reg64 rR14
va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 <
va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13
va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division` 4 /\ va_get_reg64 rRbp
va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rRsi va_s0 + 16
`op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply` (va_in_word_index + 1) <= va_in_length)
/\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8 `op_Multiply` va_in_word_index == va_in_length
/\ va_get_reg64 rRsi va_s0 + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_s0) + 8 `op_Multiply` va_in_word_index /\ va_get_reg64
rR15 va_s0 `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_s0 < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0)
va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_s0) Public /\ va_get_reg64 rRdi va_s0 == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_s0 - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp va_in_h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_s0) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s0) va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 ==
va_get_mem_heaplet 1 va_old /\ va_get_reg64 rR15 va_s0 =!= 0))
(ensures (fun (va_sM, va_fM, h, word_index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\
va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64
rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 +
va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64
rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\
va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\
va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\
va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1)
<= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index ==
va_in_length /\ va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index
/\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15
va_s0) /\ va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks_body0 va_b0 va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64
rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags] in
let va_qc = va_qcode_Poly1305_blocks_body0 va_mods va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks_body0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let (h, word_index) = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_n == pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 321 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 322 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 325 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 326 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 327 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 328 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 329 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_old + va_in_length < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 330 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_length == va_get_reg64 rRdx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 332 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 336 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 337 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM < 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 338 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 339 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 340 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 341 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 342 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
((va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 343 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 344 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 345 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let (h, word_index) = va_g in
(va_sM, va_fM, h, word_index)
[@ va_qattr]
let va_wp_Poly1305_blocks_body0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat)
(va_s0:va_state) (va_k:(va_state -> (int & nat) -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0)
pow2_64 + va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\
va_get_reg64 rR12 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division`
4 /\ va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\
va_get_reg64 rRsi va_s0 + 16 `op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply`
(va_in_word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8
`op_Multiply` va_in_word_index == va_in_length /\ va_get_reg64 rRsi va_s0 + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_s0) +
8 `op_Multiply` va_in_word_index /\ va_get_reg64 rR15 va_s0 `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_s0 < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0) va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_s0) Public /\ va_get_reg64
rRdi va_s0 == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_s0 - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp va_in_h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_s0) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s0)
va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 == va_get_mem_heaplet 1 va_old /\
va_get_reg64 rR15 va_s0 =!= 0 /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_ok:bool)
(va_x_r10:nat64) (va_x_r14:nat64) (va_x_r15:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_rax:nat64) (va_x_rbp:nat64) (va_x_rbx:nat64) (va_x_rdx:nat64) (va_x_rsi:nat64) (h:int)
(word_index:nat) . let va_sM = va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx va_x_rdx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRax va_x_rax
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64
rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10 (va_upd_ok va_x_ok (va_upd_flags va_x_efl
va_s0))))))))))) in va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n ==
va_mul_nat pow2_64 pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\
va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h ==
va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64
rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n
`op_Division` 16 /\ va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12
va_sM `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64
rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM ==
va_get_reg64 rR12 va_sM /\ va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM
== va_get_reg64 rRsi va_old + va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64
/\ va_in_length == va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8
`op_Multiply` (word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8
`op_Multiply` word_index == va_in_length /\ va_get_reg64 rRsi va_sM + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) +
8 `op_Multiply` word_index /\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_sM < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM)
(va_get_reg64 rRdi va_sM) va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public /\ va_get_reg64
rRdi va_sM == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old /\
precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15 va_s0) ==> va_k va_sM ((h,
word_index))))
val va_wpProof_Poly1305_blocks_body0 : va_old:va_state -> va_in_ctx_b:buffer64 -> va_in_h_in:int ->
va_in_inp_b:buffer64 -> va_in_length:int -> va_in_n:(va_int_range 18446744073709551616
18446744073709551616) -> va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819) -> va_in_r:int -> va_in_h:int -> va_in_word_index:nat
-> va_s0:va_state -> va_k:(va_state -> (int & nat) -> Type0)
-> Ghost (va_state & va_fuel & (int & nat))
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in
va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks_body0 ())
([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64
rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR10; va_Mod_ok; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k =
let (va_sM, va_f0, h, word_index) = va_lemma_Poly1305_blocks_body0 (va_code_Poly1305_blocks_body0
()) va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r
va_in_h va_in_word_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0)))))))))))));
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let va_g = (h, word_index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks_body0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat) :
(va_quickCode (int & nat) (va_code_Poly1305_blocks_body0 ())) =
(va_QProc (va_code_Poly1305_blocks_body0 ()) ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64
rRbx; va_Mod_reg64 rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64
rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags])
(va_wp_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index) (va_wpProof_Poly1305_blocks_body0 va_old va_in_ctx_b
va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index))
//--
//-- Poly1305_blocks_while0
val va_code_Poly1305_blocks_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks_while0 () =
(va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (va_Block
(va_CCons (va_code_Poly1305_blocks_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Poly1305_blocks_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks_while0 () =
(va_pbool_and (va_codegen_success_Poly1305_blocks_body0 ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks_while0 (va_mods:va_mods_t) (va_old:va_state) (va_in_ctx_b:buffer64)
(va_in_h_in:int) (va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range
18446744073709551616 18446744073709551616)) (va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) (va_in_r:int)
(va_in_h:int) (va_in_word_index:nat) : (va_quickCode (int & nat) (va_code_Poly1305_blocks_while0
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (ctx_b:buffer64) =
va_in_ctx_b in let (h_in:int) = va_in_h_in in let (inp_b:buffer64) = va_in_inp_b in let
(length:int) = va_in_length in let (n:(va_int_range 18446744073709551616 18446744073709551616))
= va_in_n in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_in_p in let (r:int) = va_in_r in let (h:int) =
va_in_h in let (word_index:nat) = va_in_word_index in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qWhile va_mods (Cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (fun va_g -> let (h:int) =
let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g in
word_index in qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks_body0 va_old ctx_b h_in inp_b length n p r h word_index) (fun
(va_s:va_state) va_g -> let (h, word_index) = va_g in va_QEmpty ((h, word_index))))) (fun
(va_s:va_state) va_g -> let (h:int) = let (h, word_index) = va_g in h in let (word_index:nat) =
let (h, word_index) = va_g in word_index in va_get_ok va_s /\ n == pow2_64 /\ va_mul_nat n n ==
va_mul_nat pow2_64 pow2_64 /\ p == va_mul_nat n n `op_Multiply` 4 - 5 /\ r == va_mul_nat
(va_get_reg64 rR12 va_s) n + va_get_reg64 rR11 va_s /\ h == va_mul_nat (va_get_reg64 rRbp va_s)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s) pow2_64 + va_get_reg64 rR14
va_s /\ va_get_reg64 rR11 va_s < n `op_Division` 16 /\ va_get_reg64 rR12 va_s < n `op_Division`
16 /\ va_get_reg64 rR12 va_s `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s == va_get_reg64 rR12
va_s + va_get_reg64 rR12 va_s `op_Division` 4 /\ va_get_reg64 rRbp va_s < 5 /\ va_get_reg64
rRax va_s == va_get_reg64 rR12 va_s /\ va_get_reg64 rRsi va_s + 16 `op_Multiply` va_get_reg64
rR15 va_s == va_get_reg64 rRsi va_old + length /\ va_get_reg64 rRsi va_old + length < pow2_64
/\ length == va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s =!= 0 ==> 8 `op_Multiply`
(word_index + 1) <= length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s + 8 `op_Multiply`
word_index == length /\ va_get_reg64 rRsi va_s + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 inp_b (va_get_mem_heaplet 0 va_s) + 8 `op_Multiply` word_index /\
va_get_reg64 rR15 va_s `op_Multiply` 16 <= length /\ va_get_reg64 rRcx va_s < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s) (va_get_reg64 rRdi va_s) ctx_b 24
(va_get_mem_layout va_s) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s)
(va_get_reg64 rRsi va_old) inp_b (length `op_Division` 8) (va_get_mem_layout va_s) Public /\
va_get_reg64 rRdi va_s == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s == va_get_reg64
rRcx va_old /\ (va_get_reg64 rRsi va_s - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) word_index /\
va_get_mem_heaplet 1 va_s == va_get_mem_heaplet 1 va_old) (fun (va_s:va_state) va_g -> let
(h:int) = let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g
in word_index in va_get_reg64 rR15 va_s) ((h, word_index))) (fun (va_s:va_state) va_g -> let
(h:int) = let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g
in word_index in let va_g = (h, word_index) in let ((h:int), (word_index:nat)) = va_g in
va_QEmpty ((h, word_index)))))
val va_lemma_Poly1305_blocks_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_ctx_b:buffer64 -> va_in_h_in:int -> va_in_inp_b:buffer64 -> va_in_length:int ->
va_in_n:(va_int_range 18446744073709551616 18446744073709551616) -> va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819) -> va_in_r:int
-> va_in_h:int -> va_in_word_index:nat
-> Ghost (va_state & va_fuel & int & nat)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p ==
va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12
va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat (va_get_reg64 rRbp va_s0)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0) pow2_64 + va_get_reg64 rR14
va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 <
va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13
va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division` 4 /\ va_get_reg64 rRbp
va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rRsi va_s0 + 16
`op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply` (va_in_word_index + 1) <= va_in_length)
/\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8 `op_Multiply` va_in_word_index == va_in_length
/\ va_get_reg64 rRsi va_s0 + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_s0) + 8 `op_Multiply` va_in_word_index /\ va_get_reg64
rR15 va_s0 `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_s0 < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0)
va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_s0) Public /\ va_get_reg64 rRdi va_s0 == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_s0 - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp va_in_h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_s0) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s0) va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 ==
va_get_mem_heaplet 1 va_old))
(ensures (fun (va_sM, va_fM, h, word_index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\
va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64
rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 +
va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64
rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\
va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\
va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\
va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1)
<= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index ==
va_in_length /\ va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index
/\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ ~(va_get_reg64 rR15 va_sM =!= 0) /\ va_state_eq va_sM
(va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags va_sM va_s0))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks_while0 va_b0 va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64
rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags] in
let va_qc = va_qcode_Poly1305_blocks_while0 va_mods va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks_while0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let (h, word_index) = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_n == pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 321 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 322 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 325 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 326 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 327 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 328 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 329 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_old + va_in_length < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 330 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_length == va_get_reg64 rRdx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 332 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 336 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 337 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM < 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 338 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 339 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 340 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 341 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 342 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
((va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 343 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 344 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(~(va_get_reg64 rR15 va_sM =!= 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let (h, word_index) = va_g in
(va_sM, va_fM, h, word_index)
[@ va_qattr]
let va_wp_Poly1305_blocks_while0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat)
(va_s0:va_state) (va_k:(va_state -> (int & nat) -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0)
pow2_64 + va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\
va_get_reg64 rR12 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division`
4 /\ va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\
va_get_reg64 rRsi va_s0 + 16 `op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply`
(va_in_word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8
`op_Multiply` va_in_word_index == va_in_length /\ va_get_reg64 rRsi va_s0 + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_s0) +
8 `op_Multiply` va_in_word_index /\ va_get_reg64 rR15 va_s0 `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_s0 < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0) va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_s0) Public /\ va_get_reg64
rRdi va_s0 == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_s0 - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp va_in_h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_s0) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s0)
va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 == va_get_mem_heaplet 1 va_old /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r14:nat64)
(va_x_r15:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_rax:nat64) (va_x_rbp:nat64)
(va_x_rbx:nat64) (va_x_rdx:nat64) (va_x_rsi:nat64) (h:int) (word_index:nat) . let va_sM =
va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64
rR8 va_x_r8 (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_ok va_x_ok (va_upd_flags va_x_efl va_s0))))))))))) in va_get_ok va_sM /\ va_in_n ==
pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p == va_mul_nat
va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n
+ va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64
pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\
va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM < va_in_n
`op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_sM ==
va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRbp va_sM <
5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\ va_get_reg64 rRsi va_sM + 16
`op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ 16
`op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length /\
va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b
(va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index /\ va_get_reg64 rR15 va_sM
`op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ ~(va_get_reg64 rR15 va_sM =!= 0) ==> va_k va_sM ((h,
word_index))))
val va_wpProof_Poly1305_blocks_while0 : va_old:va_state -> va_in_ctx_b:buffer64 -> va_in_h_in:int
-> va_in_inp_b:buffer64 -> va_in_length:int -> va_in_n:(va_int_range 18446744073709551616
18446744073709551616) -> va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819) -> va_in_r:int -> va_in_h:int -> va_in_word_index:nat
-> va_s0:va_state -> va_k:(va_state -> (int & nat) -> Type0)
-> Ghost (va_state & va_fuel & (int & nat))
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in
va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks_while0 ())
([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64
rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR10; va_Mod_ok; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length
va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k =
let (va_sM, va_f0, h, word_index) = va_lemma_Poly1305_blocks_while0
(va_code_Poly1305_blocks_while0 ()) va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0)))))))))))));
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let va_g = (h, word_index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks_while0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat) :
(va_quickCode (int & nat) (va_code_Poly1305_blocks_while0 ())) =
(va_QProc (va_code_Poly1305_blocks_while0 ()) ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx;
va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags])
(va_wp_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index) (va_wpProof_Poly1305_blocks_while0 va_old va_in_ctx_b
va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index))
//--
//-- Poly1305_blocks
val va_code_Poly1305_blocks : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks () =
(va_Block (va_CCons (va_code_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRdi) 32
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rR14) (va_op_reg_opr64_reg64 rRdi) 0 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRdi) 8
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rRbp) (va_op_reg_opr64_reg64 rRdi) 16 Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rR12) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_Shr64 (va_op_dst_opr64_reg64 rR13)
(va_const_shift_amt64 2)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR13)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Poly1305_blocks_while0 ()) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR14) 0 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbx) 8
Public) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rRbp) 16 Public) (va_CNil ())))))))))))))))))
val va_codegen_success_Poly1305_blocks : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks () =
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR14) (va_op_reg_opr64_reg64 rRdi) 0
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRdi) 8 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRdi) 16 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Shr64
(va_op_dst_opr64_reg64 rR13) (va_const_shift_amt64 2)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Poly1305_blocks_while0 ()) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR14) 0
Public) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbx) 8 Public) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public) (va_ttrue ()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks (va_mods:va_mods_t) (r:int) (h_in:int) (ctx_b:buffer64)
(inp_b:buffer64) : (va_quickCode (int) (va_code_Poly1305_blocks ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 285 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (let (length:int) = va_get_reg64 rRdx
va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 289 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 292 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 294 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public ctx_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 295 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 297 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR14)
(va_op_reg_opr64_reg64 rRdi) 0 Public ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 298 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbx)
(va_op_reg_opr64_reg64 rRdi) 8 Public ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 299 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRdi) 16 Public ctx_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 301 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 302 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR13) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 303 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 304 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rR12)) (fun (va_s:va_state) _
-> let (h:int) = h_in in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 307 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) 0) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp) (let
(va_arg40:(FStar.Seq.Base.seq Vale.X64.Memory.nat64)) = Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s) inp_b in let (va_arg39:Prims.int) = r in let (va_arg38:Prims.int) =
va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n) in let (va_arg37:Prims.int) =
Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 310 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg37 va_arg38 va_arg39
va_arg40 0) (va_QEmpty (())))) (let (word_index:nat) = 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 315 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks_while0 va_old_s ctx_b h_in inp_b length n p r h word_index) (fun
(va_s:va_state) va_g -> let (h, word_index) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 374 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR14) 0 Public ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 375 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbx) 8 Public ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 376 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public ctx_b 2) (va_QEmpty ((h)))))))))))))))))))))
val va_lemma_Poly1305_blocks : va_b0:va_code -> va_s0:va_state -> r:int -> h_in:int ->
ctx_b:buffer64 -> inp_b:buffer64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRdx va_s0 `op_Modulus` 16 == 0 /\
va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64 /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24 (va_get_mem_layout va_s0)
Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0)
inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout va_s0) Public /\ (let h0_in
= Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let r0_in =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let r1_in =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in h_in == va_mul_nat h2_in
(va_mul_nat n n) + va_mul_nat h1_in n + h0_in /\ r == va_mul_nat r1_in n + r0_in /\ r0_in < n
`op_Division` 16 /\ r1_in < n `op_Division` 16 /\ r1_in `op_Modulus` 4 == 0 /\ h2_in < 5 /\
va_get_reg64 rRcx va_s0 < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64
rRbp va_sM < 5 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64
rRdi va_sM) ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0
`op_Division` 8) (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific
ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 2 /\ va_get_reg64 rR14 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbx va_sM
== Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbp va_sM
== Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR11 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR12 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR13 va_sM
== va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRsi va_sM
== va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRcx va_sM == va_get_reg64
rRcx va_s0 /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 /\ (let r0_in =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) in let r1_in =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) in h == va_mul_nat
(va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM)
pow2_64 + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0 `op_Division` 8))) /\ va_state_eq
va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks va_b0 va_s0 r h_in ctx_b inp_b =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64
rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64
rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64
rRdx; va_Mod_reg64 rRsi; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Poly1305_blocks va_mods r h_in ctx_b inp_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let h = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in label
va_range1
"***** POSTCONDITION NOT MET AT line 264 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 66 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 266 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_s0) inp_b
(va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 65 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet
1 va_sM) 0 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 268 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR14 va_sM == Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 269 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbx va_sM == Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM == Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM == Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM == Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 277 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 278 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 280 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) in label
va_range1
"***** POSTCONDITION NOT MET AT line 281 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) in label
va_range1
"***** POSTCONDITION NOT MET AT line 282 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0
`op_Division` 8)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
let h = va_g in
(va_sM, va_fM, h)
[@ va_qattr]
let va_wp_Poly1305_blocks (r:int) (h_in:int) (ctx_b:buffer64) (inp_b:buffer64) (va_s0:va_state)
(va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64
in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64
rRdx va_s0 `op_Modulus` 16 == 0 /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8)
(va_get_mem_layout va_s0) Public /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0
(va_get_mem_heaplet 1 va_s0) in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1
(va_get_mem_heaplet 1 va_s0) in let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2
(va_get_mem_heaplet 1 va_s0) in let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3
(va_get_mem_heaplet 1 va_s0) in let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4
(va_get_mem_heaplet 1 va_s0) in h_in == va_mul_nat h2_in (va_mul_nat n n) + va_mul_nat h1_in n
+ h0_in /\ r == va_mul_nat r1_in n + r0_in /\ r0_in < n `op_Division` 16 /\ r1_in < n
`op_Division` 16 /\ r1_in `op_Modulus` 4 == 0 /\ h2_in < 5 /\ va_get_reg64 rRcx va_s0 < 2)) /\
(forall (va_x_mem:vale_heap) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_r10:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64)
(va_x_rbx:nat64) (va_x_rbp:nat64) (va_x_rax:nat64) (va_x_r15:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_heap1:vale_heap) (h:int) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_flags
va_x_efl (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rRbp va_x_rbp
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rRsi va_x_rsi (va_upd_mem va_x_mem va_s0))))))))))))))) in va_get_ok va_sM /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRbp va_sM < 5 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM)
(va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout
va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) 0 2 /\ va_get_reg64 rR14 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 0 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbx va_sM == Vale.X64.Decls.buffer64_read
ctx_b 1 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbp va_sM == Vale.X64.Decls.buffer64_read
ctx_b 2 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR11 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 3 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR12 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 4 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM +
va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 +
va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_s0 /\ va_get_reg64
rRdi va_sM == va_get_reg64 rRdi va_s0 /\ (let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3
(va_get_mem_heaplet 1 va_sM) in let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4
(va_get_mem_heaplet 1 va_sM) in h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64
pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0
`op_Division` 8))) ==> va_k va_sM ((h))))
val va_wpProof_Poly1305_blocks : r:int -> h_in:int -> ctx_b:buffer64 -> inp_b:buffer64 ->
va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks r h_in ctx_b inp_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks ())
([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks r h_in ctx_b inp_b va_s0 va_k =
let (va_sM, va_f0, h) = va_lemma_Poly1305_blocks (va_code_Poly1305_blocks ()) va_s0 r h_in ctx_b
inp_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM (va_update_reg64
rR15 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_mem]) va_sM va_s0;
let va_g = (h) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks (r:int) (h_in:int) (ctx_b:buffer64) (inp_b:buffer64) : (va_quickCode
int (va_code_Poly1305_blocks ())) =
(va_QProc (va_code_Poly1305_blocks ()) ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15;
va_Mod_reg64 rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_mem]) (va_wp_Poly1305_blocks r h_in ctx_b inp_b)
(va_wpProof_Poly1305_blocks r h_in ctx_b inp_b))
//--
//-- Poly1305_last_block
val va_code_Poly1305_last_block : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_last_block () =
(va_Block (va_CCons (va_IfElse (va_cmp_lt (va_op_cmp_reg64 rR15) (va_const_cmp 8)) (va_Block
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_CCons
(va_code_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_CCons (va_code_Shl64
(va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Sub64
(va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ())))))))))))))))) (va_Block
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR15)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
8)) (va_CCons (va_code_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_CCons (va_code_Shl64
(va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ()))))))))))))))))))) (va_CCons
(va_code_Poly1305_iteration ()) (va_CNil ()))))
val va_codegen_success_Poly1305_last_block : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_last_block () =
(va_pbool_and (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRcx)
(va_const_shift_amt64 3)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_const_opr64 1)) (va_pbool_and (va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRdx)
(va_op_shift_amt64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rRcx) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64
rRcx) (va_const_opr64 1)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9)
(va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_pbool_and
(va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 8)) (va_pbool_and
(va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_pbool_and
(va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbp) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64
rR14) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rRdx)) (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp)
(va_const_opr64 0))))))))))))))))))))))))))))) (va_pbool_and
(va_codegen_success_Poly1305_iteration ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_last_block (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_last_block ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r1:nat64) = va_get_reg64 rRax va_s in let
(r:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s) r1 in
let (hBlocks:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in let
(inpLast:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s)
(va_get_reg64 rR9 va_s) in let (padLast:Prims.pos) = Prims.pow2 (va_get_reg64 rR15 va_s
`op_Multiply` 8) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 409 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_lt (va_op_cmp_reg64 rR15) (va_const_cmp 8)) (qblock va_mods (fun
(va_s:va_state) -> let (va_arg78:Vale.Def.Types_s.nat64) = va_get_reg64 rR15 va_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 410 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_shift_power2 va_arg78) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 412 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 413 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 414 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 415 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdx va_s == padLast) (let (va_arg77:Vale.Def.Types_s.nat64) = va_get_reg64 rR15
va_s in let (va_arg76:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 417 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_and_mod va_arg76 va_arg77) (va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(padLast == Vale.Poly1305.Math.shift_left64 1 (Vale.Poly1305.Math.shift_left64 (va_get_reg64
rR15 va_s) 3)) (let (va_arg75:Prims.int) = Prims.pow2 (va_get_reg64 rR15 va_s `op_Multiply` 8)
in let (va_arg74:Prims.int) = va_get_reg64 rR15 va_s in let (va_arg73:Vale.Def.Types_s.nat64) =
va_get_reg64 rR9 va_s in let (va_arg72:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 420 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mod_power2_lo va_arg72 va_arg73 va_arg74 va_arg75)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 421 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 422 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR8 va_s == va_get_reg64 rR8 va_old_s `op_Modulus` padLast) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == inpLast
`op_Modulus` padLast) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 429 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 430 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 431 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 433 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 434 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 435 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QEmpty
(())))))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 437 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_s - 8 >= 0 /\ va_get_reg64 rR15 va_s - 8 <= 255) (fun _ -> let
(nExtra8:nat8) = va_get_reg64 rR15 va_s - 8 in let (va_arg85:Vale.Def.Types_s.nat64) = nExtra8
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_shift_power2 va_arg85) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 441 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 442 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 443 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (fun
(va_s:va_state) _ -> va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(padLast == Vale.Poly1305.Math.lowerUpper128 0 (va_get_reg64 rRdx va_s)) (let
(va_arg84:Prims.nat) = 8 `op_Multiply` nExtra8 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 446 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_power2_add64 va_arg84) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 447 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg83:Vale.Def.Types_s.nat64) = nExtra8 in let (va_arg82:Vale.Def.Types_s.nat64) =
va_get_reg64 rR9 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 451 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_and_mod va_arg82 va_arg83) (va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 452 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Prims.pow2 (8 `op_Multiply` nExtra8) >= 0 /\ Prims.pow2 (8 `op_Multiply` nExtra8) <=
18446744073709551615) (fun _ -> let (va_arg81:Vale.Def.Types_s.nat64) = Prims.pow2 (8
`op_Multiply` nExtra8) in let (va_arg80:Vale.Def.Types_s.nat64) = va_get_reg64 rR9 va_s in let
(va_arg79:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 452 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mod_hi va_arg79 va_arg80 va_arg81) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 453 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 454 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 455 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx)) (fun (va_s:va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 456 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == inpLast
`op_Modulus` padLast) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 459 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 460 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 461 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QEmpty
(()))))))))))))))))))))))))) (fun (va_s:va_state) va_g -> let (h:int) = hBlocks + inpLast
`op_Modulus` padLast + padLast in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 469 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx
va_s) n + va_get_reg64 rR14 va_s) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 469 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 469 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (va_qAssertBy
va_range1
"***** PRECONDITION NOT MET AT line 470 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == va_mul_nat r1 n + va_get_reg64 rR11 va_s) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 470 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 471 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_iteration r1) (fun (va_s:va_state) (hLast:int) -> va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 472 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hLast == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 472 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 472 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg71:Prims.int) = r in let (va_arg70:Prims.int) = inpLast `op_Modulus` padLast + padLast
in let (va_arg69:Prims.pos) = p in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 473 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_demod va_arg69 hBlocks va_arg70 va_arg71)
(va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 474 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r)) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 474 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_QEmpty (()))) (va_QEmpty (()))))))))))
val va_lemma_Poly1305_last_block : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_last_block ()) va_s0 /\ va_get_ok va_s0 /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n
`op_Division` 16 /\ r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division`
4 /\ (1 <= va_get_reg64 rR15 va_s0 /\ va_get_reg64 rR15 va_s0 < 16))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_sM < 5 /\ (let padLast = Prims.pow2 (va_get_reg64 rR15 va_sM `op_Multiply`
8) in let hLast = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM) in
Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0)))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_last_block va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_last_block va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_last_block ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 380 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 402 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let padLast = Prims.pow2 (va_get_reg64 rR15 va_sM `op_Multiply` 8) in label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let hLast = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64
rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 405 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_last_block (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n
`op_Division` 16 /\ r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division`
4 /\ (1 <= va_get_reg64 rR15 va_s0 /\ va_get_reg64 rR15 va_s0 < 16)) /\ (forall
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64) (va_x_efl:Vale.X64.Flags.t)
. let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64
rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax
va_s0))))))))) in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616
18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r1:nat64) = va_get_reg64 rRax va_s0 in let
(r:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in
let (hBlocks:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let
(inpLast:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0)
(va_get_reg64 rR9 va_s0) in va_get_reg64 rRbp va_sM < 5 /\ (let padLast = Prims.pow2
(va_get_reg64 rR15 va_sM `op_Multiply` 8) in let hLast = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM) in Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp
((Vale.Poly1305.Spec_s.modp hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply`
r))) ==> va_k va_sM (())))
val va_wpProof_Poly1305_last_block : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_last_block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_last_block ())
([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_last_block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_last_block (va_code_Poly1305_last_block ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_last_block () : (va_quickCode unit (va_code_Poly1305_last_block ())) =
(va_QProc (va_code_Poly1305_last_block ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax]) va_wp_Poly1305_last_block va_wpProof_Poly1305_last_block)
//--
//-- Poly1305_reduce_last
val va_code_Poly1305_reduce_last : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_reduce_last () =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_CCons
(va_code_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (va_CCons (va_code_Shr64
(va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_Sub64Wrap
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 0)) (va_CCons (va_code_Sub64Wrap
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Add64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Add64
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CNil ())))))))))))))))))))
val va_codegen_success_Poly1305_reduce_last : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_reduce_last () =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_const_opr64 1))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64
rR10)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rR8)) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64
rR9)) (va_ttrue ()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_reduce_last (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_reduce_last ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 490 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 492 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 493 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 494 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 495 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 496 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 497 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 499 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h + 5 == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8
va_s) (va_get_reg64 rR9 va_s)) (va_get_reg64 rR10 va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 500 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 500 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_QEmpty (())))) (let
(va_arg32:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in let
(va_arg31:Vale.Def.Types_s.nat64) = va_get_reg64 rR9 va_s in let
(va_arg30:Vale.Def.Types_s.nat64) = va_get_reg64 rR10 va_s in let (va_arg29:Prims.int) = h + 5
in let (va_arg28:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_old_s in let
(va_arg27:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_old_s in let
(va_arg26:Vale.Def.Types_s.nat64) = va_get_reg64 rRbp va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 501 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_reduce128 h va_arg26 va_arg27 va_arg28 va_arg29
va_arg30 va_arg31 va_arg32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 506 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_const_opr64 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 509 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 511 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 514 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 515 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 518 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 519 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QEmpty
(())))))))))))))))))))))))
val va_lemma_Poly1305_reduce_last : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_reduce_last ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in va_get_reg64
rRbp va_s0 < 5)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_reduce_last va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_reduce_last va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_reduce_last ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 478 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 488 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_reduce_last (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in va_get_reg64 rRbp va_s0 < 5) /\ (forall (va_x_r8:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_rax:nat64) (va_x_r14:nat64) (va_x_rbx:nat64)
(va_x_rbp:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rRax
va_x_rax (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8
va_s0))))))) in va_get_ok va_sM /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM)
(va_get_reg64 rRbx va_sM) == Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)) ==>
va_k va_sM (())))
val va_wpProof_Poly1305_reduce_last : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_reduce_last va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_reduce_last ())
([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rRax;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_reduce_last va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_reduce_last (va_code_Poly1305_reduce_last ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_reduce_last () : (va_quickCode unit (va_code_Poly1305_reduce_last ())) =
(va_QProc (va_code_Poly1305_reduce_last ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8])
va_wp_Poly1305_reduce_last va_wpProof_Poly1305_reduce_last)
//--
//-- Poly1305_add_key_s
val va_code_Poly1305_add_key_s : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_add_key_s () =
(va_Block (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_CNil
()))))
val va_codegen_success_Poly1305_add_key_s : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_add_key_s () =
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rRdx)) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_add_key_s (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_add_key_s ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s) (va_get_reg64 rRdx va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 536 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 537 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (fun (va_s:va_state)
_ -> let (va_arg18:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_s in let
(va_arg17:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_s in let (va_arg16:Prims.int) = key_s
in let (va_arg15:Vale.Def.Types_s.nat64) = va_get_reg64 rRdx va_s in let
(va_arg14:Vale.Def.Types_s.nat64) = va_get_reg64 rRax va_s in let (va_arg13:Prims.int) = h_in
in let (va_arg12:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_old_s in let
(va_arg11:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 539 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_add_key va_arg11 va_arg12 va_arg13 va_arg14 va_arg15
va_arg16 va_arg17 va_arg18) (va_QEmpty (()))))))
val va_lemma_Poly1305_add_key_s : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_add_key_s ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_ok va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_add_key_s va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_add_key_s va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_add_key_s ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 523 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 534 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_add_key_s (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 va_s0))
in va_get_ok va_sM /\ (let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)) ==> va_k va_sM (())))
val va_wpProof_Poly1305_add_key_s : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_add_key_s va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_add_key_s ()) ([va_Mod_flags;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_add_key_s va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_add_key_s (va_code_Poly1305_add_key_s ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_ok va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_add_key_s () : (va_quickCode unit (va_code_Poly1305_add_key_s ())) =
(va_QProc (va_code_Poly1305_add_key_s ()) ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14])
va_wp_Poly1305_add_key_s va_wpProof_Poly1305_add_key_s)
//--
// REVIEW: not clear why Vale.Def.TypesNative_s.reveal_iand doesn't work directly
let reveal_logand128 (x y:nat128) : Lemma
(requires True)
(ensures Vale.Def.Types_s.iand x y == FStar.UInt.logand #128 x y)
= Vale.Def.TypesNative_s.reveal_iand 128 x y
//-- reveal_logand128
//--
//-- Poly1305_impl
val va_code_Poly1305_impl : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_impl () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rRdi) 32
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1152921487695413247)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64
rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1152921487695413244)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64
rRcx)) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rR11) 24 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR12) 32
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx))
(va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_CCons
(va_code_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRdx) 64
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons
(va_code_Poly1305_blocks ()) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdi) 184 Public) (va_CCons (va_IfElse
(va_cmp_eq (va_op_cmp_reg64 rRax) (va_const_cmp 1)) (va_Block (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15) (va_op_reg_opr64_reg64 rRdi) 56
Public) (va_CCons (va_IfElse (va_cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (va_Block
(va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsi) 0
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rR9) (va_op_reg_opr64_reg64 rRsi) 8 Public) (va_CCons (va_code_Poly1305_last_block ()) (va_CNil
())))))) (va_Block (va_CNil ()))) (va_CCons (va_code_Poly1305_reduce_last ()) (va_CCons
(va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 40 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRdi) 48
Public) (va_CCons (va_code_Poly1305_add_key_s ()) (va_CNil ())))))))) (va_Block (va_CNil ())))
(va_CNil ())))))))))))))))))))
val va_codegen_success_Poly1305_impl : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_impl () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413247)) (va_pbool_and
(va_codegen_success_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRcx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413244))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR11) 24 Public) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR12) 32 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_And64
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_pbool_and (va_codegen_success_Sub64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRdx) 64
Public) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1)) (va_pbool_and (va_codegen_success_Poly1305_blocks ()) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 184 Public) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRdi) 56 Public) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsi) 0
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRsi) 8 Public)
(va_codegen_success_Poly1305_last_block ())))) (va_pbool_and
(va_codegen_success_Poly1305_reduce_last ()) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdi) 40
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRdi) 48 Public)
(va_codegen_success_Poly1305_add_key_s ())))))) (va_ttrue ()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_impl (va_mods:va_mods_t) (key_r:nat128) (key_s:nat128) (ctx_b:buffer64)
(inp_b:buffer64) (finish:nat64) : (va_quickCode (int) (va_code_Poly1305_impl ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (inp_in:nat64) = va_get_reg64 rRsi
va_s in let (len_in:nat64) = va_get_reg64 rRdx va_s in let (h0_in:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s) in let
(h1_in:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1
va_s) in let (h2_in:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 2
(va_get_mem_heaplet 1 va_s) in let (h_in:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let (key_r0:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s) in let
(key_r1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1
va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 607 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 609 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public ctx_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 610 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 611 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413247)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 612 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 613 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413244)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 614 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 615 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR11) 24 Public ctx_b 3) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 616 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR12) 32 Public ctx_b 4) (fun (va_s:va_state) _ -> let (r:nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s) (va_get_reg64 rR12 va_s) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 619 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == va_get_reg64 rR11 va_s + va_mul_nat n (va_get_reg64 rR12 va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 619 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (let
(mask:nat128) = 21267647620597763993911028882763415551 in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 622 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == Vale.Arch.Types.iand128 key_r mask) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 624 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (let
(va_arg81:Vale.Def.Types_s.nat64) = va_get_reg64 rR12 va_s in let
(va_arg80:Vale.Def.Types_s.nat64) = va_get_reg64 rR11 va_s in let
(va_arg79:Vale.Def.Words_s.nat128) = r in let (va_arg78:Vale.Def.Words_s.nat128) = mask in let
(va_arg77:Vale.Def.Words_s.nat128) = key_r in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 625 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_lowerUpper128_and va_arg77 key_r0 key_r1 va_arg78
1152921487695413247 1152921487695413244 va_arg79 va_arg80 va_arg81) (va_QEmpty (())))) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 629 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 630 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 631 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 634 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public ctx_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 635 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRdx) 64 Public ctx_b 8) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 637 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (fun (va_s:va_state) _ ->
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 638 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h_in == va_mul_nat h2_in (va_mul_nat n n) + va_mul_nat h1_in n + h0_in) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 638 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 638 column 105 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_QEmpty (())))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 639 column 7 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks r h_in ctx_b inp_b) (fun (va_s:va_state) (h:int) -> va_qAssertBy
va_range1
"***** PRECONDITION NOT MET AT line 640 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 641 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 641 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg76:Prims.int) = va_get_reg64 rRdx va_old_s `op_Division` 16 in let
(va_arg75:Vale.X64.Memory.buffer64) = inp_b in let (va_arg74:Vale.X64.Memory.vale_heap) =
va_get_mem_heaplet 0 va_s in let (va_arg73:Prims.int) = r in let (va_arg72:Prims.int) =
va_mul_nat n n in let (va_arg71:Prims.int) = Vale.Poly1305.Spec_s.modp h_in in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 642 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.lemma_poly1305_heap_hash_blocks_alt va_arg71 va_arg72
va_arg73 va_arg74 va_arg75 va_arg76) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 644 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 184 Public ctx_b 23) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 645 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_eq (va_op_cmp_reg64 rRax) (va_const_cmp 1)) (qblock va_mods (fun
(va_s:va_state) -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 647 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> reveal_logand128 key_r mask) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 648 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == Vale.Poly1305.Math.bare_r key_r) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 650 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRdi) 56 Public ctx_b 7) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 652 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 654 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 655 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8)
(va_op_reg_opr64_reg64 rRsi) 0 Public inp_b (len_in `op_Division` 16 `op_Multiply` 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 656 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRsi) 8 Public inp_b (len_in `op_Division` 16 `op_Multiply` 2 + 1)) (fun
(va_s:va_state) _ -> let (a:Vale.X64.Machine_s.nat128) = Vale.Poly1305.Util.seqTo128_app
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) (len_in `op_Division` 16) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 658 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == a)
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 659 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 660 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_last_block ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in va_QEmpty ((h))))))))) (qblock va_mods
(fun (va_s:va_state) -> va_QEmpty ((h))))) (fun (va_s:va_state) va_g -> let (h:int) = va_g in
let (va_arg70:Prims.int) = key_s in let (va_arg69:Prims.int) = Vale.Poly1305.Spec_s.modp h in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 664 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_add_mod128 va_arg69 va_arg70) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 665 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_reduce_last ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 668 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 40 Public ctx_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 669 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRdi) 48 Public ctx_b 6) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 670 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_add_key_s ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 673 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in) key_r key_s
(Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s)
inp_b)) len_in) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 674 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%mod2_128) mod2_128 mod2_128) (fun _ -> va_reveal_opaque
(`%mod2_128) mod2_128) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 674 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_QEmpty (())))) (va_QEmpty ((h)))))))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((h))))) (fun (va_s:va_state) va_g -> let (h:int) = va_g in va_QEmpty
((h)))))))))))))))))))))))))))
val va_lemma_Poly1305_impl : va_b0:va_code -> va_s0:va_state -> key_r:nat128 -> key_s:nat128 ->
ctx_b:buffer64 -> inp_b:buffer64 -> finish:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_impl ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRsi va_s0) inp_b (Vale.Poly1305.Util.readable_words (va_get_reg64 rRdx va_s0))
(va_get_mem_layout va_s0) Public /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let key_r0
= Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem_heaplet 1 va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s0) in finish ==
Vale.X64.Decls.buffer64_read ctx_b 23 (va_get_mem_heaplet 1 va_s0) /\ key_r ==
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 /\ key_s == Vale.Poly1305.Math.lowerUpper128
key_s0 key_s1 /\ h2_in < 5 /\ finish < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 8 /\ (let h0_in =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0
va_sM) inp_b) in (finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\ (finish == 0 ==> Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (va_get_reg64 rRdx va_s0 `op_Division` 16)) /\
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ (finish == 1 ==> h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) /\
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi
va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_impl va_b0 va_s0 key_r key_s ctx_b inp_b finish =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64
rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Poly1305_impl va_mods key_r key_s ctx_b inp_b finish in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_impl ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let h = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 551 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 66 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 65 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet
1 va_sM) 0 8) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 587 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 588 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 589 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h_in = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in)
h2_in in label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet
0 va_sM) inp_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 591 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 593 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Spec_s.poly1305_hash_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n) (Vale.Poly1305.Spec_s.make_r key_r) inp_mem
(va_get_reg64 rRdx va_s0 `op_Division` 16)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 594 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 595 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==> h == Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64
rRbx va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 596 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 597 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
let h = va_g in
(va_sM, va_fM, h)
[@ va_qattr]
let va_wp_Poly1305_impl (key_r:nat128) (key_s:nat128) (ctx_b:buffer64) (inp_b:buffer64)
(finish:nat64) (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64
in Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) inp_b (Vale.Poly1305.Util.readable_words (va_get_reg64 rRdx
va_s0)) (va_get_mem_layout va_s0) Public /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 <
pow2_64 /\ (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in
let key_r0 = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem_heaplet 1 va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s0) in finish ==
Vale.X64.Decls.buffer64_read ctx_b 23 (va_get_mem_heaplet 1 va_s0) /\ key_r ==
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 /\ key_s == Vale.Poly1305.Math.lowerUpper128
key_s0 key_s1 /\ h2_in < 5 /\ finish < 2)) /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_rbx:nat64)
(va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64)
(va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_heap1:vale_heap) (h:int) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_flags
va_x_efl (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRbx va_x_rbx (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx
va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))) in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616
18446744073709551616)) = pow2_64 in Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM)
(va_get_reg64 rRdi va_sM) ctx_b 24 (va_get_mem_layout va_sM) Public /\
Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet
1 va_sM) 0 8 /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0)
in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0
va_sM) inp_b) in (finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\ (finish == 0 ==> Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (va_get_reg64 rRdx va_s0 `op_Division` 16)) /\
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ (finish == 1 ==> h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) /\
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi
va_s0)) ==> va_k va_sM ((h))))
val va_wpProof_Poly1305_impl : key_r:nat128 -> key_s:nat128 -> ctx_b:buffer64 -> inp_b:buffer64 ->
finish:nat64 -> va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_impl key_r key_s ctx_b inp_b finish va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_impl ()) ([va_Mod_mem_heaplet
1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_impl key_r key_s ctx_b inp_b finish va_s0 va_k =
let (va_sM, va_f0, h) = va_lemma_Poly1305_impl (va_code_Poly1305_impl ()) va_s0 key_r key_s ctx_b
inp_b finish in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM (va_update_reg64
rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0;
let va_g = (h) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_impl (key_r:nat128) (key_s:nat128) (ctx_b:buffer64) (inp_b:buffer64)
(finish:nat64) : (va_quickCode int (va_code_Poly1305_impl ())) =
(va_QProc (va_code_Poly1305_impl ()) ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15;
va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi;
va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem])
(va_wp_Poly1305_impl key_r key_s ctx_b inp_b finish) (va_wpProof_Poly1305_impl key_r key_s
ctx_b inp_b finish))
//--
//-- Poly1305
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305 win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rRax) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11)
(va_op_opr64_reg64 rRsi)) (va_CCons (if win then va_Block (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))) else va_Block (va_CNil
())) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rRcx) 184 Public) (va_CCons (va_code_Push_Secret
(va_op_reg_opr64_reg64 rRbx)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbp))
(va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRax)) (va_CCons (va_code_Push_Secret
(va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret
(va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15))
(va_CCons (va_code_Poly1305_impl ()) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR14) 0
Public) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rRbx) 8 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbp) 16
Public) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons
(va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret
(va_op_dst_opr64_reg64 rR13)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR12))
(va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CCons (va_code_Pop_Secret
(va_op_dst_opr64_reg64 rRax)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbp))
(va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_DestroyHeaplets ())
(va_CNil ())))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305 win =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRsi)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue
())))) else va_ttrue ()) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 184
Public) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx))
(va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbp)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR11)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and
(va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Poly1305_impl ()) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR14) 0
Public) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbx) 8 Public) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rRbp)) (va_pbool_and (va_codegen_success_Pop_Secret
(va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rRdi) (va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue
()))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305 (va_mods:va_mods_t) (win:bool) (ctx_b:buffer64) (inp_b:buffer64)
(len_in:nat64) (finish_in:nat64) : (va_quickCode unit (va_code_Poly1305 win)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(ctx_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s)
(fun _ -> va_get_reg64 rRdi va_s) in let (inp_in:(va_int_range 0 18446744073709551615)) = va_if
win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 754 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer64 inp_b 0 Public Immutable; declare_buffer64 ctx_b 1
Public Mutable])) (fun (va_s:va_state) _ -> let (key_r0:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s) in let
(key_r1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1
va_s) in let (key_s0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 5
(va_get_mem_heaplet 1 va_s) in let (key_s1:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s) in let
(key_r:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let
(key_s:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 764 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdi)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 765 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRsi)) (fun (va_s:va_state) _
-> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 766 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 768 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 769 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 770 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 771 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (())))))))
(qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 785 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx) 184 Public ctx_b 23) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 788 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 789 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 790 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 791 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 792 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 793 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 794 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 795 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 797 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_impl key_r key_s ctx_b inp_b finish_in) (fun (va_s:va_state) (h':int) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 799 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR14) 0 Public ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 800 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbx) 8 Public ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 801 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public ctx_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 804 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 805 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 806 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 807 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 808 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 809 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 810 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 811 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 813 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 815 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Poly1305.Util.fsti.checked",
"Vale.Poly1305.Spec_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.TypesNative_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Poly1305.X64.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Spec_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
win: Prims.bool ->
ctx_b: Vale.X64.Memory.buffer64 ->
inp_b: Vale.X64.Memory.buffer64 ->
len_in: Vale.X64.Memory.nat64 ->
finish_in: Vale.X64.Memory.nat64
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Prims.bool",
"Vale.X64.Memory.buffer64",
"Vale.X64.Memory.nat64",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_stackTaint",
"Vale.X64.QuickCode.va_Mod_stack",
"Vale.X64.QuickCode.va_Mod_mem_layout",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Machine_s.rR14",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rRsp",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.Poly1305.X64.va_code_Poly1305",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.Poly1305.Util.modifies_buffer",
"Vale.X64.Decls.va_get_mem",
"Prims.l_imp",
"Prims.int",
"Vale.Poly1305.Spec_s.modp",
"Vale.Poly1305.Spec_s.poly1305_hash_blocks",
"Vale.X64.Decls.va_mul_nat",
"Vale.Poly1305.Spec_s.make_r",
"Prims.op_Division",
"Prims.op_LessThan",
"Vale.Poly1305.Spec_s.poly1305_hash_all",
"Vale.Def.Types_s.nat64",
"Vale.X64.Decls.va_get_reg64",
"Vale.Poly1305.Util.t_seqTo128",
"Vale.Poly1305.Util.seqTo128",
"Vale.X64.Decls.buffer64_as_seq",
"Vale.Poly1305.Math.lowerUpper192",
"Vale.Def.Words_s.nat128",
"Vale.Poly1305.Math.lowerUpper128",
"Vale.Def.Words_s.nat64",
"Vale.X64.Decls.buffer64_read",
"Vale.X64.Decls.va_int_range",
"Prims.op_Subtraction",
"Prims.op_Multiply",
"Vale.X64.Decls.va_if",
"Prims.l_not",
"Vale.X64.QuickCode.quickCode",
"Vale.Poly1305.X64.va_qcode_Poly1305"
] | [] | false | false | false | false | false | let va_lemma_Poly1305 va_b0 va_s0 win ctx_b inp_b len_in finish_in =
| let va_mods:va_mods_t =
[
va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 1; va_Mod_flags;
va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;
va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem
]
in
let va_qc = va_qcode_Poly1305 va_mods win ctx_b inp_b len_in finish_in in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Poly1305 win)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 683 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\
(let ctx_in:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0)
in
let inp_in:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
in
let n:(va_int_range 18446744073709551616 18446744073709551616) = 18446744073709551616 in
let p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819) =
(va_mul_nat n n) `op_Multiply` 4 - 5
in
label va_range1
"***** POSTCONDITION NOT MET AT line 718 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 720 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 721 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 722 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 723 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r0 = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 724 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r1 = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 725 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 726 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 727 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
h0_in
h1_in)
h2_in
in
label va_range1
"***** POSTCONDITION NOT MET AT line 728 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_r =
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1
in
label va_range1
"***** POSTCONDITION NOT MET AT line 729 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let key_s =
Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1
in
label va_range1
"***** POSTCONDITION NOT MET AT line 731 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_out =
Vale.X64.Decls.buffer64_read ctx_b
0
(va_get_mem va_sM)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 732 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_out =
Vale.X64.Decls.buffer64_read ctx_b
1
(va_get_mem va_sM)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 733 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_out =
Vale.X64.Decls.buffer64_read ctx_b
2
(va_get_mem va_sM)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 734 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h10 =
Vale.Poly1305.Math.lowerUpper128
h0_out
h1_out
in
label va_range1
"***** POSTCONDITION NOT MET AT line 735 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h210 =
Vale.Poly1305.Math.lowerUpper192
h10
h2_out
in
label va_range1
"***** POSTCONDITION NOT MET AT line 736 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let inp_mem =
Vale.Poly1305.Util.seqTo128
(Vale.X64.Decls.buffer64_as_seq
(va_get_mem va_sM)
inp_b)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 739 column 103 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 0 ==>
Vale.Poly1305.Spec_s.modp
h210 ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks
(Vale.Poly1305.Spec_s.modp
h_in)
(va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r
key_r)
inp_mem
(len_in
`op_Division`
16)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 740 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 0 ==>
h2_out < 5) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 741 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish_in == 1 ==>
h10 ==
Vale.Poly1305.Spec_s.poly1305_hash_all
(Vale.Poly1305.Spec_s.modp
h_in)
key_r
key_s
inp_mem
len_in) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 743 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsp va_sM ==
va_get_reg64 rRsp
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 745 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(win ==>
va_get_reg64 rRdi
va_sM ==
va_get_reg64 rRdi
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 746 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(win ==>
va_get_reg64 rRsi
va_sM ==
va_get_reg64 rRsi
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 747 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 748 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM ==
va_get_reg64 rRbp
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 749 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM ==
va_get_reg64 rR12
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 750 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM ==
va_get_reg64 rR13
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 751 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR14 va_sM ==
va_get_reg64 rR14
va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 752 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM ==
va_get_reg64 rR15
va_s0)))))))))))))))
))))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 1; va_Mod_flags;
va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;
va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem
])
va_sM
va_s0;
(va_sM, va_fM) | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_and'_prop | val pairwise_and'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma ((pairwise_and' f l) `subtype_of` unit) | val pairwise_and'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma ((pairwise_and' f l) `subtype_of` unit) | let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 42,
"end_line": 78,
"start_col": 0,
"start_line": 75
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (ensures Prims.subtype_of (FStar.BigOps.pairwise_and' f l) Prims.unit) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_and'_nil",
"FStar.BigOps.pairwise_and'_cons",
"Prims.unit"
] | [] | false | false | true | false | false | let pairwise_and'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_and'_nil f
| hd :: tl -> pairwise_and'_cons f hd tl | false |
FStar.BigOps.fst | FStar.BigOps.big_or'_cons | val big_or'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a)
: Lemma (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) | val big_or'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a)
: Lemma (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) | let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute()) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 76,
"end_line": 55,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> hd: a -> tl: Prims.list a
-> FStar.Pervasives.Lemma
(ensures FStar.BigOps.big_or' f (hd :: tl) == (f hd \/ FStar.BigOps.big_or' f tl)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.BigOps.big_or'",
"Prims.Cons",
"Prims.l_or",
"Prims.unit",
"FStar.Tactics.V2.Derived.compute"
] | [] | false | false | true | false | false | let big_or'_cons (#a: Type) (f: (a -> Type)) (hd: a) (tl: list a) =
| FStar.Tactics.Effect.assert_by_tactic (big_or' f (hd :: tl) == (f hd \/ big_or' f tl))
(fun _ ->
();
(T.compute ())) | false |
Vale.Poly1305.X64.fst | Vale.Poly1305.X64.va_lemma_Poly1305_impl | val va_lemma_Poly1305_impl : va_b0:va_code -> va_s0:va_state -> key_r:nat128 -> key_s:nat128 ->
ctx_b:buffer64 -> inp_b:buffer64 -> finish:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_impl ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRsi va_s0) inp_b (Vale.Poly1305.Util.readable_words (va_get_reg64 rRdx va_s0))
(va_get_mem_layout va_s0) Public /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let key_r0
= Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem_heaplet 1 va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s0) in finish ==
Vale.X64.Decls.buffer64_read ctx_b 23 (va_get_mem_heaplet 1 va_s0) /\ key_r ==
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 /\ key_s == Vale.Poly1305.Math.lowerUpper128
key_s0 key_s1 /\ h2_in < 5 /\ finish < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 8 /\ (let h0_in =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0
va_sM) inp_b) in (finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\ (finish == 0 ==> Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (va_get_reg64 rRdx va_s0 `op_Division` 16)) /\
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ (finish == 1 ==> h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) /\
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi
va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))) | val va_lemma_Poly1305_impl : va_b0:va_code -> va_s0:va_state -> key_r:nat128 -> key_s:nat128 ->
ctx_b:buffer64 -> inp_b:buffer64 -> finish:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_impl ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRsi va_s0) inp_b (Vale.Poly1305.Util.readable_words (va_get_reg64 rRdx va_s0))
(va_get_mem_layout va_s0) Public /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let key_r0
= Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem_heaplet 1 va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s0) in finish ==
Vale.X64.Decls.buffer64_read ctx_b 23 (va_get_mem_heaplet 1 va_s0) /\ key_r ==
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 /\ key_s == Vale.Poly1305.Math.lowerUpper128
key_s0 key_s1 /\ h2_in < 5 /\ finish < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 8 /\ (let h0_in =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0
va_sM) inp_b) in (finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\ (finish == 0 ==> Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (va_get_reg64 rRdx va_s0 `op_Division` 16)) /\
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ (finish == 1 ==> h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) /\
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi
va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))) | let va_lemma_Poly1305_impl va_b0 va_s0 key_r key_s ctx_b inp_b finish =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64
rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Poly1305_impl va_mods key_r key_s ctx_b inp_b finish in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_impl ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let h = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 551 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 66 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 65 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet
1 va_sM) 0 8) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 587 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 588 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 589 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h_in = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in)
h2_in in label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet
0 va_sM) inp_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 591 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 593 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Spec_s.poly1305_hash_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n) (Vale.Poly1305.Spec_s.make_r key_r) inp_mem
(va_get_reg64 rRdx va_s0 `op_Division` 16)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 594 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 595 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==> h == Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64
rRbx va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 596 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 597 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
let h = va_g in
(va_sM, va_fM, h) | {
"file_name": "obj/Vale.Poly1305.X64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 2658,
"start_col": 0,
"start_line": 2602
} | module Vale.Poly1305.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.Poly1305.Spec_s
open Vale.Poly1305.Math
open Vale.Poly1305.Util
#reset-options "--z3rlimit 40"
//-- Poly1305_multiply
val va_code_Poly1305_multiply : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_multiply () =
(va_Block (va_CCons (va_code_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mul64Wrap
(va_op_opr64_reg64 rR14)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR11)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_CCons
(va_code_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rRbp)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdx)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR13)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR9)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 0)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64
rR11)) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 18446744073709551612))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_CNil
()))))))))))))))))))))))))))
val va_codegen_success_Poly1305_multiply : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_multiply () =
(va_pbool_and (va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_pbool_and
(va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64
rRdx)) (va_pbool_and (va_codegen_success_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRbp)) (va_pbool_and
(va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64
rRdx)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64
rR13)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR9)
(va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rR10) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rRbp)
(va_op_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rRax) (va_const_opr64 18446744073709551612)) (va_pbool_and (va_codegen_success_Adc64Wrap
(va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_ttrue ())))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_multiply (va_mods:va_mods_t) (r1:nat64) : (va_quickCode (int)
(va_code_Poly1305_multiply ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s) n +
va_get_reg64 rR14 va_s in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 93 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR14 va_s) r1 == va_mul_nat r1 (va_get_reg64 rR14 va_s)) (va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 94 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR11 va_s) (va_get_reg64 rR14 va_s) == va_mul_nat (va_get_reg64 rR14
va_s) (va_get_reg64 rR11 va_s)) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 95 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR11 va_s) (va_get_reg64 rRbx va_s) == va_mul_nat (va_get_reg64 rRbx
va_s) (va_get_reg64 rR11 va_s)) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 97 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat (va_get_reg64 rR13 va_s) (va_get_reg64 rRbx va_s) == va_mul_nat (va_get_reg64 rRbx
va_s) (va_get_reg64 rR13 va_s)) (let (gd0:int) = va_mul_nat (va_get_reg64 rR14 va_s)
(va_get_reg64 rR11 va_s) + va_mul_nat (va_get_reg64 rRbx va_s) (va_get_reg64 rR13 va_s) in let
(gd1:int) = va_mul_nat (va_get_reg64 rR14 va_s) r1 + va_mul_nat (va_get_reg64 rRbx va_s)
(va_get_reg64 rR11 va_s) + va_mul_nat (va_get_reg64 rRbp va_s) (va_get_reg64 rR13 va_s) in let
(gd2:int) = va_mul_nat (va_get_reg64 rRbp va_s) (va_get_reg64 rR11 va_s) in va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 105 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.va_is_src_opr64 (Vale.X64.Decls.va_op_opr64_reg64 rR14) va_s) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 107 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 108 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 109 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 112 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 113 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 114 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 119 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mul64Wrap (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 126 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 132 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR11)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 138 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 139 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 18446744073709551612)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 140 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (fun (va_s:va_state)
_ -> let (hh:int) = va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_s) + va_mul_nat n
(va_get_reg64 rRbx va_s) + va_get_reg64 rR14 va_s in let (va_arg61:Prims.int) = hh in let
(va_arg60:Prims.int) = gd2 in let (va_arg59:Prims.int) = gd1 in let (va_arg58:Prims.int) = gd0
in let (va_arg57:Prims.int) = va_get_reg64 rR13 va_s in let (va_arg56:Prims.int) = va_get_reg64
rRbp va_old_s in let (va_arg55:Prims.int) = va_get_reg64 rRbx va_old_s in let
(va_arg54:Prims.int) = va_get_reg64 rR14 va_old_s in let (va_arg53:Prims.int) = r1 in let
(va_arg52:Prims.int) = va_get_reg64 rR11 va_s in let (va_arg51:Prims.int) = h in let
(va_arg50:Prims.int) = r in let (va_arg49:Prims.int) = p in let (va_arg48:Prims.int) = n in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_multiply va_arg48 va_arg49 va_arg50 va_arg51
va_arg52 va_arg53 va_arg54 va_arg55 va_arg56 va_arg57 va_arg58 va_arg59 va_arg60 va_arg61)
(va_QEmpty ((hh))))))))))))))))))))))))))))))))))
val va_lemma_Poly1305_multiply : va_b0:va_code -> va_s0:va_state -> r1:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_multiply ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s0 in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n +
va_get_reg64 rR14 va_s0 in r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1
`op_Division` 4 /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR11 va_s0) < 7
`op_Multiply` (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rR14 va_s0) r1 < va_mul_nat n (n
`op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0) (va_get_reg64 rR11 va_s0) <
va_mul_nat n (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13
va_s0) < va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rR14 va_s0) (va_get_reg64
rR11 va_s0) < va_mul_nat n (n `op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0)
(va_get_reg64 rR13 va_s0) < va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rRbp
va_s0) (va_get_reg64 rR13 va_s0) < 7 `op_Multiply` (5 `op_Multiply` n `op_Division` 64) /\
va_get_reg64 rRax va_s0 == r1)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p /\
va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM `op_Division`
4 < 18446744073709551616 /\ va_get_reg64 rRax va_sM == 18446744073709551612) /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok
va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_multiply va_b0 va_s0 r1 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_ok] in
let va_qc = va_qcode_Poly1305_multiply va_mods r1 in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_multiply ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 62 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
label va_range1
"***** POSTCONDITION NOT MET AT line 88 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 89 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 90 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM
`op_Division` 4 < 18446744073709551616) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 91 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == 18446744073709551612))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_multiply (r1:nat64) (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64
in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_mul_nat
(va_get_reg64 rRbp va_s0) (va_get_reg64 rR11 va_s0) < 7 `op_Multiply` (n `op_Division` 16) /\
va_mul_nat (va_get_reg64 rR14 va_s0) r1 < va_mul_nat n (n `op_Division` 16) /\ va_mul_nat
(va_get_reg64 rRbx va_s0) (va_get_reg64 rR11 va_s0) < va_mul_nat n (n `op_Division` 16) /\
va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13 va_s0) < va_mul_nat n (n `op_Division`
8) /\ va_mul_nat (va_get_reg64 rR14 va_s0) (va_get_reg64 rR11 va_s0) < va_mul_nat n (n
`op_Division` 16) /\ va_mul_nat (va_get_reg64 rRbx va_s0) (va_get_reg64 rR13 va_s0) <
va_mul_nat n (n `op_Division` 8) /\ va_mul_nat (va_get_reg64 rRbp va_s0) (va_get_reg64 rR13
va_s0) < 7 `op_Multiply` (5 `op_Multiply` n `op_Division` 64) /\ va_get_reg64 rRax va_s0 == r1)
/\ (forall (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64)
(va_x_rbp:nat64) (va_x_rax:nat64) (va_x_rdx:nat64) (va_x_efl:Vale.X64.Flags.t) (hh:int) . let
va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax
(va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14
(va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 va_s0))))))))
in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rR10 va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p /\
va_get_reg64 rR10 va_sM `op_Division` 4 `op_Multiply` 4 + va_get_reg64 rR10 va_sM `op_Division`
4 < 18446744073709551616 /\ va_get_reg64 rRax va_sM == 18446744073709551612) ==> va_k va_sM
((hh))))
val va_wpProof_Poly1305_multiply : r1:nat64 -> va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_multiply r1 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_multiply ()) ([va_Mod_flags;
va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_multiply r1 va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_multiply (va_code_Poly1305_multiply ()) va_s0 r1 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64
rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok
va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8])
va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_multiply (r1:nat64) : (va_quickCode int (va_code_Poly1305_multiply ())) =
(va_QProc (va_code_Poly1305_multiply ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8]) (va_wp_Poly1305_multiply r1) (va_wpProof_Poly1305_multiply r1))
//--
//-- Poly1305_reduce
val va_code_Poly1305_reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_reduce () =
(va_Block (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10)) (va_CCons
(va_code_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ()))))))))))
val va_codegen_success_Poly1305_reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_reduce () =
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64
rR10)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbp) (va_const_opr64 0)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_reduce (va_mods:va_mods_t) : (va_quickCode (int) (va_code_Poly1305_reduce
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (hd:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_mul_nat n n)
(va_get_reg64 rR10 va_s) + va_mul_nat n (va_get_reg64 rRbx va_s) + va_get_reg64 rR14 va_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 164 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 170 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 171 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 173 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
let (h10:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat n (va_get_reg64
rRbx va_old_s) + va_get_reg64 rR14 va_old_s in let (hh:int) = h10 + va_get_reg64 rRax va_s +
va_mul_nat (va_get_reg64 rR10 va_old_s `op_Modulus` 4) (va_mul_nat n n) in let
(va_arg27:Prims.int) = hh in let (va_arg26:Prims.int) = va_get_reg64 rRax va_s in let
(va_arg25:Prims.int) = h10 in let (va_arg24:Prims.int) = va_get_reg64 rR10 va_old_s in let
(va_arg23:Prims.int) = hd in let (va_arg22:Prims.int) = p in let (va_arg21:Prims.int) = n in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 177 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_reduce va_arg21 va_arg22 va_arg23 va_arg24
va_arg25 va_arg26 va_arg27) (va_QEmpty ((hh))))))))))))))
val va_lemma_Poly1305_reduce : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in va_get_reg64 rR10 va_s0 `op_Division` 4 `op_Multiply` 4 +
va_get_reg64 rR10 va_s0 `op_Division` 4 < n /\ va_get_reg64 rRax va_s0 ==
18446744073709551612)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) +
va_mul_nat n (va_get_reg64 rRbx va_sM) + va_get_reg64 rR14 va_sM /\ hd `op_Modulus` p == hh
`op_Modulus` p /\ va_get_reg64 rRbp va_sM < 5) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_reduce va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_reduce va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_reduce ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in label va_range1
"***** POSTCONDITION NOT MET AT line 160 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 161 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hd `op_Modulus` p == hh `op_Modulus` p) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 162 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_reduce (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(hd:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_mul_nat n n) (va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) +
va_get_reg64 rR14 va_s0 in va_get_reg64 rR10 va_s0 `op_Division` 4 `op_Multiply` 4 +
va_get_reg64 rR10 va_s0 `op_Division` 4 < n /\ va_get_reg64 rRax va_s0 == 18446744073709551612)
/\ (forall (va_x_rax:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64)
(va_x_efl:Vale.X64.Flags.t) (hh:int) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp
va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (hd:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_mul_nat n n)
(va_get_reg64 rR10 va_s0) + va_mul_nat n (va_get_reg64 rRbx va_s0) + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ hd `op_Modulus` p == hh `op_Modulus` p /\ va_get_reg64 rRbp
va_sM < 5) ==> va_k va_sM ((hh))))
val va_wpProof_Poly1305_reduce : va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_reduce va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_reduce ()) ([va_Mod_flags;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_reduce va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_reduce (va_code_Poly1305_reduce ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_reduce () : (va_quickCode int (va_code_Poly1305_reduce ())) =
(va_QProc (va_code_Poly1305_reduce ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rRax]) va_wp_Poly1305_reduce
va_wpProof_Poly1305_reduce)
//--
//-- Poly1305_iteration
val va_code_Poly1305_iteration : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_iteration () =
(va_Block (va_CCons (va_code_Poly1305_multiply ()) (va_CCons (va_code_Poly1305_reduce ())
(va_CNil ()))))
val va_codegen_success_Poly1305_iteration : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_iteration () =
(va_pbool_and (va_codegen_success_Poly1305_multiply ()) (va_pbool_and
(va_codegen_success_Poly1305_reduce ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_iteration (va_mods:va_mods_t) (r1:nat64) : (va_quickCode (int)
(va_code_Poly1305_iteration ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s) n +
va_get_reg64 rR14 va_s in let (va_arg50:Prims.int) = n `op_Division` 16 in let
(va_arg49:Prims.int) = va_get_reg64 rR11 va_s in let (va_arg48:Prims.int) = va_get_reg64 rRbp
va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg48 7 va_arg49 va_arg50)
(let (va_arg47:Prims.int) = n `op_Division` 16 in let (va_arg46:Prims.int) = r1 in let
(va_arg45:Prims.int) = n in let (va_arg44:Prims.int) = va_get_reg64 rR14 va_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 211 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg44 va_arg45 va_arg46
va_arg47) (let (va_arg43:Prims.int) = n `op_Division` 16 in let (va_arg42:Prims.int) =
va_get_reg64 rR11 va_s in let (va_arg41:Prims.int) = n in let (va_arg40:Prims.int) =
va_get_reg64 rRbx va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg40 va_arg41 va_arg42
va_arg43) (let (va_arg39:Prims.int) = n `op_Division` 8 in let (va_arg38:Prims.int) =
va_get_reg64 rR13 va_s in let (va_arg37:Prims.int) = n in let (va_arg36:Prims.int) =
va_get_reg64 rRbp va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg36 va_arg37 va_arg38
va_arg39) (let (va_arg35:Prims.int) = n `op_Division` 16 in let (va_arg34:Prims.int) =
va_get_reg64 rR11 va_s in let (va_arg33:Prims.int) = n in let (va_arg32:Prims.int) =
va_get_reg64 rR14 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg32 va_arg33 va_arg34
va_arg35) (let (va_arg31:Prims.int) = n `op_Division` 8 in let (va_arg30:Prims.int) =
va_get_reg64 rR13 va_s in let (va_arg29:Prims.int) = n in let (va_arg28:Prims.int) =
va_get_reg64 rRbx va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 215 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg28 va_arg29 va_arg30
va_arg31) (let (va_arg27:Prims.int) = 5 `op_Multiply` n `op_Division` 64 in let
(va_arg26:Prims.int) = va_get_reg64 rR13 va_s in let (va_arg25:Prims.int) = va_get_reg64 rRbp
va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 216 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mul_strict_upper_bound va_arg25 7 va_arg26 va_arg27)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 218 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_multiply r1) (fun (va_s:va_state) (hd:int) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_reduce ()) (fun (va_s:va_state) (hh:int) -> va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 220 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 221 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(l_and (hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_s) + va_mul_nat n (va_get_reg64
rRbx va_s) + va_get_reg64 rR14 va_s) (va_mul_nat h r `op_Modulus` p == hh `op_Modulus` p))
(va_QEmpty ((hh)))))))))))))))
val va_lemma_Poly1305_iteration : va_b0:va_code -> va_s0:va_state -> r1:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_iteration ()) va_s0 /\ va_get_ok va_s0 /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n `op_Division` 16 /\ r1 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_get_reg64 rRbp va_s0 < 7 /\
va_get_reg64 rRax va_s0 == r1)))
(ensures (fun (va_sM, va_fM, hh) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp (va_mul_nat h r) ==
Vale.Poly1305.Spec_s.modp hh /\ va_get_reg64 rRbp va_sM < 5) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_iteration va_b0 va_s0 r1 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_ok] in
let va_qc = va_qcode_Poly1305_iteration va_mods r1 in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_iteration ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let hh = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
label va_range1
"***** POSTCONDITION NOT MET AT line 200 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) + va_mul_nat n (va_get_reg64 rRbx
va_sM) + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 201 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp (va_mul_nat h r) == Vale.Poly1305.Spec_s.modp hh) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 202 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax;
va_Mod_ok]) va_sM va_s0;
let hh = va_g in
(va_sM, va_fM, hh)
[@ va_qattr]
let va_wp_Poly1305_iteration (r1:nat64) (va_s0:va_state) (va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r:(va_int_range 0 340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64
rR11 va_s0 in let (h:(va_int_range 0
6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat (va_get_reg64 rRbp
va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n + va_get_reg64 rR14 va_s0 in
va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n `op_Division` 16 /\ r1 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division` 4 /\ va_get_reg64 rRbp va_s0 < 7 /\
va_get_reg64 rRax va_s0 == r1) /\ (forall (va_x_rax:nat64) (va_x_rdx:nat64) (va_x_r8:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64)
(va_x_efl:Vale.X64.Flags.t) (hh:int) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp
va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rRax va_x_rax va_s0)))))))) in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616
18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r:(va_int_range 0
340282366920938463463374607431768211455)) = va_mul_nat r1 n + va_get_reg64 rR11 va_s0 in let
(h:(va_int_range 0 6277101735386680763835789423207666416102355444464034512895)) = va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx va_s0) n +
va_get_reg64 rR14 va_s0 in hh == va_mul_nat (va_mul_nat n n) (va_get_reg64 rRbp va_sM) +
va_mul_nat n (va_get_reg64 rRbx va_sM) + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp
(va_mul_nat h r) == Vale.Poly1305.Spec_s.modp hh /\ va_get_reg64 rRbp va_sM < 5) ==> va_k va_sM
((hh))))
val va_wpProof_Poly1305_iteration : r1:nat64 -> va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_iteration r1 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_iteration ()) ([va_Mod_flags;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9;
va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_iteration r1 va_s0 va_k =
let (va_sM, va_f0, hh) = va_lemma_Poly1305_iteration (va_code_Poly1305_iteration ()) va_s0 r1 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRax])
va_sM va_s0;
let va_g = (hh) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_iteration (r1:nat64) : (va_quickCode int (va_code_Poly1305_iteration ())) =
(va_QProc (va_code_Poly1305_iteration ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) (va_wp_Poly1305_iteration r1) (va_wpProof_Poly1305_iteration r1))
//--
//-- Poly1305_blocks_body0
val va_code_Poly1305_blocks_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks_body0 () =
(va_Block (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64
rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Public))
(va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_CCons
(va_code_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 16))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rRcx)) (va_CCons
(va_code_Poly1305_iteration ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64
1)) (va_CNil ())))))))))))
val va_codegen_success_Poly1305_blocks_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks_body0 () =
(va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Public)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_pbool_and
(va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi)
(va_const_opr64 16)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp)
(va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Poly1305_iteration ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64 1))
(va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_ctx_b:buffer64)
(va_in_h_in:int) (va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range
18446744073709551616 18446744073709551616)) (va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) (va_in_r:int)
(va_in_h:int) (va_in_word_index:nat) : (va_quickCode (int & nat) (va_code_Poly1305_blocks_body0
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (ctx_b:buffer64) =
va_in_ctx_b in let (h_in:int) = va_in_h_in in let (inp_b:buffer64) = va_in_inp_b in let
(length:int) = va_in_length in let (n:(va_int_range 18446744073709551616 18446744073709551616))
= va_in_n in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_in_p in let (r:int) = va_in_r in let (h:int) =
va_in_h in let (word_index:nat) = va_in_word_index in let (nn:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (hp:int) = h in let (h:int) = h +
va_mul_nat (va_mul_nat nn nn) (va_get_reg64 rRcx va_s) + va_mul_nat nn
(Vale.X64.Decls.buffer64_read inp_b (word_index + 1) (va_get_mem_heaplet 0 va_s)) +
Vale.X64.Decls.buffer64_read inp_b word_index (va_get_mem_heaplet 0 va_s) in let (hq:int) = h
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 353 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 inp_b word_index
Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 353 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet
0) (va_op_reg64_reg64 rRsi) 0 Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 354 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 inp_b
(word_index + 1) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 354 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet
0) (va_op_reg64_reg64 rRsi) 8 Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 355 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 16))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 356 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_op_opr64_reg64 rRcx)) (fun (va_s:va_state)
_ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 358 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hq == va_mul_nat (va_get_reg64 rRbp va_s) (va_mul_nat nn nn) + va_mul_nat (va_get_reg64 rRbx
va_s) nn + va_get_reg64 rR14 va_s) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 360 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_iteration (va_get_reg64 rR12 va_s)) (fun (va_s:va_state) (h:int) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 362 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 363 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rR15) (va_const_opr64 1)) (fun (va_s:va_state) _ -> let
(word_index:nat) = word_index + 2 in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 366 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) word_index) (let
(va_arg50:Prims.int) = word_index in let (va_arg49:(FStar.Seq.Base.seq Vale.X64.Memory.nat64))
= Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b in let (va_arg48:Prims.int)
= r in let (va_arg47:Prims.int) = va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn) in let
(va_arg46:Prims.int) = Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 368 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg46 va_arg47 va_arg48
va_arg49 va_arg50) (let (va_arg45:Prims.int) = word_index - 2 in let
(va_arg44:(FStar.Seq.Base.seq Vale.X64.Memory.nat64)) = Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s) inp_b in let (va_arg43:Prims.int) = r in let (va_arg42:Prims.int) =
va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat nn nn) in let (va_arg41:Prims.int) =
Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 369 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg41 va_arg42 va_arg43
va_arg44 va_arg45) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 370 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp) (let
(va_arg40:Prims.int) = r in let (va_arg39:Prims.int) = hq - hp in let (va_arg38:Prims.int) = hp
in let (va_arg37:Prims.pos) = p in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_demod va_arg37 va_arg38 va_arg39 va_arg40)
(va_QEmpty (())))))) (va_QEmpty ((h, word_index)))))))))))))))
val va_lemma_Poly1305_blocks_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_ctx_b:buffer64 -> va_in_h_in:int -> va_in_inp_b:buffer64 -> va_in_length:int ->
va_in_n:(va_int_range 18446744073709551616 18446744073709551616) -> va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819) -> va_in_r:int
-> va_in_h:int -> va_in_word_index:nat
-> Ghost (va_state & va_fuel & int & nat)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p ==
va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12
va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat (va_get_reg64 rRbp va_s0)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0) pow2_64 + va_get_reg64 rR14
va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 <
va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13
va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division` 4 /\ va_get_reg64 rRbp
va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rRsi va_s0 + 16
`op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply` (va_in_word_index + 1) <= va_in_length)
/\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8 `op_Multiply` va_in_word_index == va_in_length
/\ va_get_reg64 rRsi va_s0 + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_s0) + 8 `op_Multiply` va_in_word_index /\ va_get_reg64
rR15 va_s0 `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_s0 < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0)
va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_s0) Public /\ va_get_reg64 rRdi va_s0 == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_s0 - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp va_in_h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_s0) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s0) va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 ==
va_get_mem_heaplet 1 va_old /\ va_get_reg64 rR15 va_s0 =!= 0))
(ensures (fun (va_sM, va_fM, h, word_index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\
va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64
rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 +
va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64
rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\
va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\
va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\
va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1)
<= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index ==
va_in_length /\ va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index
/\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15
va_s0) /\ va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks_body0 va_b0 va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64
rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags] in
let va_qc = va_qcode_Poly1305_blocks_body0 va_mods va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks_body0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let (h, word_index) = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_n == pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 321 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 322 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 325 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 326 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 327 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 328 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 329 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_old + va_in_length < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 330 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_length == va_get_reg64 rRdx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 332 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 336 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 337 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM < 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 338 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 339 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 340 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 341 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 342 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
((va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 343 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 344 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 345 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let (h, word_index) = va_g in
(va_sM, va_fM, h, word_index)
[@ va_qattr]
let va_wp_Poly1305_blocks_body0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat)
(va_s0:va_state) (va_k:(va_state -> (int & nat) -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0)
pow2_64 + va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\
va_get_reg64 rR12 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division`
4 /\ va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\
va_get_reg64 rRsi va_s0 + 16 `op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply`
(va_in_word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8
`op_Multiply` va_in_word_index == va_in_length /\ va_get_reg64 rRsi va_s0 + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_s0) +
8 `op_Multiply` va_in_word_index /\ va_get_reg64 rR15 va_s0 `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_s0 < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0) va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_s0) Public /\ va_get_reg64
rRdi va_s0 == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_s0 - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp va_in_h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_s0) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s0)
va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 == va_get_mem_heaplet 1 va_old /\
va_get_reg64 rR15 va_s0 =!= 0 /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_ok:bool)
(va_x_r10:nat64) (va_x_r14:nat64) (va_x_r15:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_rax:nat64) (va_x_rbp:nat64) (va_x_rbx:nat64) (va_x_rdx:nat64) (va_x_rsi:nat64) (h:int)
(word_index:nat) . let va_sM = va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx va_x_rdx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRax va_x_rax
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64
rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10 (va_upd_ok va_x_ok (va_upd_flags va_x_efl
va_s0))))))))))) in va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n ==
va_mul_nat pow2_64 pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\
va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h ==
va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64
rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n
`op_Division` 16 /\ va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12
va_sM `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64
rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM ==
va_get_reg64 rR12 va_sM /\ va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM
== va_get_reg64 rRsi va_old + va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64
/\ va_in_length == va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8
`op_Multiply` (word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8
`op_Multiply` word_index == va_in_length /\ va_get_reg64 rRsi va_sM + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) +
8 `op_Multiply` word_index /\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_sM < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM)
(va_get_reg64 rRdi va_sM) va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public /\ va_get_reg64
rRdi va_sM == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old /\
precedes_wrap (va_get_reg64 rR15 va_sM) (va_get_reg64 rR15 va_s0) ==> va_k va_sM ((h,
word_index))))
val va_wpProof_Poly1305_blocks_body0 : va_old:va_state -> va_in_ctx_b:buffer64 -> va_in_h_in:int ->
va_in_inp_b:buffer64 -> va_in_length:int -> va_in_n:(va_int_range 18446744073709551616
18446744073709551616) -> va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819) -> va_in_r:int -> va_in_h:int -> va_in_word_index:nat
-> va_s0:va_state -> va_k:(va_state -> (int & nat) -> Type0)
-> Ghost (va_state & va_fuel & (int & nat))
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in
va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks_body0 ())
([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64
rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR10; va_Mod_ok; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k =
let (va_sM, va_f0, h, word_index) = va_lemma_Poly1305_blocks_body0 (va_code_Poly1305_blocks_body0
()) va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r
va_in_h va_in_word_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0)))))))))))));
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let va_g = (h, word_index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks_body0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat) :
(va_quickCode (int & nat) (va_code_Poly1305_blocks_body0 ())) =
(va_QProc (va_code_Poly1305_blocks_body0 ()) ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64
rRbx; va_Mod_reg64 rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64
rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags])
(va_wp_Poly1305_blocks_body0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index) (va_wpProof_Poly1305_blocks_body0 va_old va_in_ctx_b
va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index))
//--
//-- Poly1305_blocks_while0
val va_code_Poly1305_blocks_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks_while0 () =
(va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (va_Block
(va_CCons (va_code_Poly1305_blocks_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Poly1305_blocks_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks_while0 () =
(va_pbool_and (va_codegen_success_Poly1305_blocks_body0 ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks_while0 (va_mods:va_mods_t) (va_old:va_state) (va_in_ctx_b:buffer64)
(va_in_h_in:int) (va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range
18446744073709551616 18446744073709551616)) (va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) (va_in_r:int)
(va_in_h:int) (va_in_word_index:nat) : (va_quickCode (int & nat) (va_code_Poly1305_blocks_while0
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (ctx_b:buffer64) =
va_in_ctx_b in let (h_in:int) = va_in_h_in in let (inp_b:buffer64) = va_in_inp_b in let
(length:int) = va_in_length in let (n:(va_int_range 18446744073709551616 18446744073709551616))
= va_in_n in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_in_p in let (r:int) = va_in_r in let (h:int) =
va_in_h in let (word_index:nat) = va_in_word_index in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qWhile va_mods (Cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (fun va_g -> let (h:int) =
let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g in
word_index in qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks_body0 va_old ctx_b h_in inp_b length n p r h word_index) (fun
(va_s:va_state) va_g -> let (h, word_index) = va_g in va_QEmpty ((h, word_index))))) (fun
(va_s:va_state) va_g -> let (h:int) = let (h, word_index) = va_g in h in let (word_index:nat) =
let (h, word_index) = va_g in word_index in va_get_ok va_s /\ n == pow2_64 /\ va_mul_nat n n ==
va_mul_nat pow2_64 pow2_64 /\ p == va_mul_nat n n `op_Multiply` 4 - 5 /\ r == va_mul_nat
(va_get_reg64 rR12 va_s) n + va_get_reg64 rR11 va_s /\ h == va_mul_nat (va_get_reg64 rRbp va_s)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s) pow2_64 + va_get_reg64 rR14
va_s /\ va_get_reg64 rR11 va_s < n `op_Division` 16 /\ va_get_reg64 rR12 va_s < n `op_Division`
16 /\ va_get_reg64 rR12 va_s `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s == va_get_reg64 rR12
va_s + va_get_reg64 rR12 va_s `op_Division` 4 /\ va_get_reg64 rRbp va_s < 5 /\ va_get_reg64
rRax va_s == va_get_reg64 rR12 va_s /\ va_get_reg64 rRsi va_s + 16 `op_Multiply` va_get_reg64
rR15 va_s == va_get_reg64 rRsi va_old + length /\ va_get_reg64 rRsi va_old + length < pow2_64
/\ length == va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s =!= 0 ==> 8 `op_Multiply`
(word_index + 1) <= length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s + 8 `op_Multiply`
word_index == length /\ va_get_reg64 rRsi va_s + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 inp_b (va_get_mem_heaplet 0 va_s) + 8 `op_Multiply` word_index /\
va_get_reg64 rR15 va_s `op_Multiply` 16 <= length /\ va_get_reg64 rRcx va_s < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s) (va_get_reg64 rRdi va_s) ctx_b 24
(va_get_mem_layout va_s) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s)
(va_get_reg64 rRsi va_old) inp_b (length `op_Division` 8) (va_get_mem_layout va_s) Public /\
va_get_reg64 rRdi va_s == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s == va_get_reg64
rRcx va_old /\ (va_get_reg64 rRsi va_s - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) word_index /\
va_get_mem_heaplet 1 va_s == va_get_mem_heaplet 1 va_old) (fun (va_s:va_state) va_g -> let
(h:int) = let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g
in word_index in va_get_reg64 rR15 va_s) ((h, word_index))) (fun (va_s:va_state) va_g -> let
(h:int) = let (h, word_index) = va_g in h in let (word_index:nat) = let (h, word_index) = va_g
in word_index in let va_g = (h, word_index) in let ((h:int), (word_index:nat)) = va_g in
va_QEmpty ((h, word_index)))))
val va_lemma_Poly1305_blocks_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_ctx_b:buffer64 -> va_in_h_in:int -> va_in_inp_b:buffer64 -> va_in_length:int ->
va_in_n:(va_int_range 18446744073709551616 18446744073709551616) -> va_in_p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819) -> va_in_r:int
-> va_in_h:int -> va_in_word_index:nat
-> Ghost (va_state & va_fuel & int & nat)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p ==
va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12
va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat (va_get_reg64 rRbp va_s0)
(va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0) pow2_64 + va_get_reg64 rR14
va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 <
va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13
va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division` 4 /\ va_get_reg64 rRbp
va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rRsi va_s0 + 16
`op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply` (va_in_word_index + 1) <= va_in_length)
/\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8 `op_Multiply` va_in_word_index == va_in_length
/\ va_get_reg64 rRsi va_s0 + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_s0) + 8 `op_Multiply` va_in_word_index /\ va_get_reg64
rR15 va_s0 `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_s0 < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0)
va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_s0) Public /\ va_get_reg64 rRdi va_s0 == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_s0 - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp va_in_h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_s0) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s0) va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 ==
va_get_mem_heaplet 1 va_old))
(ensures (fun (va_sM, va_fM, h, word_index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\
va_get_ok va_sM /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64
rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 +
va_get_reg64 rR14 va_sM /\ va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64
rR12 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\
va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\
va_get_reg64 rRbp va_sM < 5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\
va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1)
<= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index ==
va_in_length /\ va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr
#Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index
/\ va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ ~(va_get_reg64 rR15 va_sM =!= 0) /\ va_state_eq va_sM
(va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags va_sM va_s0))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks_while0 va_b0 va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64
rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64
rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags] in
let va_qc = va_qcode_Poly1305_blocks_while0 va_mods va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks_while0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let (h, word_index) = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_n == pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n + va_get_reg64 rR11 va_sM) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 321 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 322 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM < va_in_n `op_Division` 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 325 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 326 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 327 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 328 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 16 `op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old
+ va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 329 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_old + va_in_length < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 330 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_in_length == va_get_reg64 rRdx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 332 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(16 `op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64
va_in_inp_b (va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 336 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_sM `op_Multiply` 16 <= va_in_length) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 337 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM < 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 338 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 339 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 340 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 341 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 342 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
((va_get_reg64 rRsi va_sM - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 343 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_inp_b) word_index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 344 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_mem_heaplet 1 va_sM == va_get_mem_heaplet 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(~(va_get_reg64 rR15 va_sM =!= 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let (h, word_index) = va_g in
(va_sM, va_fM, h, word_index)
[@ va_qattr]
let va_wp_Poly1305_blocks_while0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat)
(va_s0:va_state) (va_k:(va_state -> (int & nat) -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_n == pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64
pow2_64 /\ va_in_p == va_mul_nat va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat
(va_get_reg64 rR12 va_s0) va_in_n + va_get_reg64 rR11 va_s0 /\ va_in_h == va_mul_nat
(va_get_reg64 rRbp va_s0) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_s0)
pow2_64 + va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR11 va_s0 < va_in_n `op_Division` 16 /\
va_get_reg64 rR12 va_s0 < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_s0 `op_Modulus` 4 ==
0 /\ va_get_reg64 rR13 va_s0 == va_get_reg64 rR12 va_s0 + va_get_reg64 rR12 va_s0 `op_Division`
4 /\ va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rRax va_s0 == va_get_reg64 rR12 va_s0 /\
va_get_reg64 rRsi va_s0 + 16 `op_Multiply` va_get_reg64 rR15 va_s0 == va_get_reg64 rRsi va_old
+ va_in_length /\ va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length ==
va_get_reg64 rRdx va_old /\ (va_get_reg64 rR15 va_s0 =!= 0 ==> 8 `op_Multiply`
(va_in_word_index + 1) <= va_in_length) /\ 16 `op_Multiply` va_get_reg64 rR15 va_s0 + 8
`op_Multiply` va_in_word_index == va_in_length /\ va_get_reg64 rRsi va_s0 + 0 ==
Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b (va_get_mem_heaplet 0 va_s0) +
8 `op_Multiply` va_in_word_index /\ va_get_reg64 rR15 va_s0 `op_Multiply` 16 <= va_in_length /\
va_get_reg64 rRcx va_s0 < 2 /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0) va_in_ctx_b 24 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old)
va_in_inp_b (va_in_length `op_Division` 8) (va_get_mem_layout va_s0) Public /\ va_get_reg64
rRdi va_s0 == va_get_reg64 rRdi va_old /\ va_get_reg64 rRcx va_s0 == va_get_reg64 rRcx va_old
/\ (va_get_reg64 rRsi va_s0 - va_get_reg64 rRsi va_old) `op_Modulus` 16 == 0 /\
Vale.Poly1305.Spec_s.modp va_in_h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat (va_get_reg64 rRcx va_s0) (va_mul_nat
va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s0)
va_in_inp_b) va_in_word_index /\ va_get_mem_heaplet 1 va_s0 == va_get_mem_heaplet 1 va_old /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r14:nat64)
(va_x_r15:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_rax:nat64) (va_x_rbp:nat64)
(va_x_rbx:nat64) (va_x_rdx:nat64) (va_x_rsi:nat64) (h:int) (word_index:nat) . let va_sM =
va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64
rR8 va_x_r8 (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10
(va_upd_ok va_x_ok (va_upd_flags va_x_efl va_s0))))))))))) in va_get_ok va_sM /\ va_in_n ==
pow2_64 /\ va_mul_nat va_in_n va_in_n == va_mul_nat pow2_64 pow2_64 /\ va_in_p == va_mul_nat
va_in_n va_in_n `op_Multiply` 4 - 5 /\ va_in_r == va_mul_nat (va_get_reg64 rR12 va_sM) va_in_n
+ va_get_reg64 rR11 va_sM /\ h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64
pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\
va_get_reg64 rR11 va_sM < va_in_n `op_Division` 16 /\ va_get_reg64 rR12 va_sM < va_in_n
`op_Division` 16 /\ va_get_reg64 rR12 va_sM `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_sM ==
va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRbp va_sM <
5 /\ va_get_reg64 rRax va_sM == va_get_reg64 rR12 va_sM /\ va_get_reg64 rRsi va_sM + 16
`op_Multiply` va_get_reg64 rR15 va_sM == va_get_reg64 rRsi va_old + va_in_length /\
va_get_reg64 rRsi va_old + va_in_length < pow2_64 /\ va_in_length == va_get_reg64 rRdx va_old
/\ (va_get_reg64 rR15 va_sM =!= 0 ==> 8 `op_Multiply` (word_index + 1) <= va_in_length) /\ 16
`op_Multiply` va_get_reg64 rR15 va_sM + 8 `op_Multiply` word_index == va_in_length /\
va_get_reg64 rRsi va_sM + 0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint64 va_in_inp_b
(va_get_mem_heaplet 0 va_sM) + 8 `op_Multiply` word_index /\ va_get_reg64 rR15 va_sM
`op_Multiply` 16 <= va_in_length /\ va_get_reg64 rRcx va_sM < 2 /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM)
va_in_ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old) va_in_inp_b (va_in_length `op_Division`
8) (va_get_mem_layout va_sM) Public /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_old /\
va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_old /\ (va_get_reg64 rRsi va_sM - va_get_reg64
rRsi va_old) `op_Modulus` 16 == 0 /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp va_in_h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat va_in_n va_in_n)) va_in_r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_inp_b) word_index /\ va_get_mem_heaplet 1 va_sM ==
va_get_mem_heaplet 1 va_old /\ ~(va_get_reg64 rR15 va_sM =!= 0) ==> va_k va_sM ((h,
word_index))))
val va_wpProof_Poly1305_blocks_while0 : va_old:va_state -> va_in_ctx_b:buffer64 -> va_in_h_in:int
-> va_in_inp_b:buffer64 -> va_in_length:int -> va_in_n:(va_int_range 18446744073709551616
18446744073709551616) -> va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819) -> va_in_r:int -> va_in_h:int -> va_in_word_index:nat
-> va_s0:va_state -> va_k:(va_state -> (int & nat) -> Type0)
-> Ghost (va_state & va_fuel & (int & nat))
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in
va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks_while0 ())
([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64
rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR10; va_Mod_ok; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length
va_in_n va_in_p va_in_r va_in_h va_in_word_index va_s0 va_k =
let (va_sM, va_f0, h, word_index) = va_lemma_Poly1305_blocks_while0
(va_code_Poly1305_blocks_while0 ()) va_s0 va_old va_in_ctx_b va_in_h_in va_in_inp_b
va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRax va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_ok va_sM (va_update_flags
va_sM va_s0)))))))))))));
va_lemma_norm_mods ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRbx; va_Mod_reg64 rRbp;
va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rR15; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let va_g = (h, word_index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks_while0 (va_old:va_state) (va_in_ctx_b:buffer64) (va_in_h_in:int)
(va_in_inp_b:buffer64) (va_in_length:int) (va_in_n:(va_int_range 18446744073709551616
18446744073709551616)) (va_in_p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) (va_in_r:int) (va_in_h:int) (va_in_word_index:nat) :
(va_quickCode (int & nat) (va_code_Poly1305_blocks_while0 ())) =
(va_QProc (va_code_Poly1305_blocks_while0 ()) ([va_Mod_reg64 rRsi; va_Mod_reg64 rRdx;
va_Mod_reg64 rRbx; va_Mod_reg64 rRbp; va_Mod_reg64 rRax; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_ok; va_Mod_flags])
(va_wp_Poly1305_blocks_while0 va_old va_in_ctx_b va_in_h_in va_in_inp_b va_in_length va_in_n
va_in_p va_in_r va_in_h va_in_word_index) (va_wpProof_Poly1305_blocks_while0 va_old va_in_ctx_b
va_in_h_in va_in_inp_b va_in_length va_in_n va_in_p va_in_r va_in_h va_in_word_index))
//--
//-- Poly1305_blocks
val va_code_Poly1305_blocks : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_blocks () =
(va_Block (va_CCons (va_code_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRdi) 32
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rR14) (va_op_reg_opr64_reg64 rRdi) 0 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRdi) 8
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rRbp) (va_op_reg_opr64_reg64 rRdi) 16 Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rR12) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_Shr64 (va_op_dst_opr64_reg64 rR13)
(va_const_shift_amt64 2)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR13)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Poly1305_blocks_while0 ()) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR14) 0 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbx) 8
Public) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rRbp) 16 Public) (va_CNil ())))))))))))))))))
val va_codegen_success_Poly1305_blocks : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_blocks () =
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR14) (va_op_reg_opr64_reg64 rRdi) 0
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRdi) 8 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRdi) 16 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Shr64
(va_op_dst_opr64_reg64 rR13) (va_const_shift_amt64 2)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Poly1305_blocks_while0 ()) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR14) 0
Public) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRbx) 8 Public) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public) (va_ttrue ()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_blocks (va_mods:va_mods_t) (r:int) (h_in:int) (ctx_b:buffer64)
(inp_b:buffer64) : (va_quickCode (int) (va_code_Poly1305_blocks ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 285 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (let (length:int) = va_get_reg64 rRdx
va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 289 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rRdx) (va_const_shift_amt64 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 292 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 294 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public ctx_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 295 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 297 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR14)
(va_op_reg_opr64_reg64 rRdi) 0 Public ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 298 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbx)
(va_op_reg_opr64_reg64 rRdi) 8 Public ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 299 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRdi) 16 Public ctx_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 301 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR13)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 302 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR13) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 303 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 304 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rR12)) (fun (va_s:va_state) _
-> let (h:int) = h_in in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 307 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) 0) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp) (let
(va_arg40:(FStar.Seq.Base.seq Vale.X64.Memory.nat64)) = Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_s) inp_b in let (va_arg39:Prims.int) = r in let (va_arg38:Prims.int) =
va_mul_nat (va_get_reg64 rRcx va_s) (va_mul_nat n n) in let (va_arg37:Prims.int) =
Vale.Poly1305.Spec_s.modp h_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 310 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.reveal_poly1305_heap_blocks va_arg37 va_arg38 va_arg39
va_arg40 0) (va_QEmpty (())))) (let (word_index:nat) = 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 315 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks_while0 va_old_s ctx_b h_in inp_b length n p r h word_index) (fun
(va_s:va_state) va_g -> let (h, word_index) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 374 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR14) 0 Public ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 375 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbx) 8 Public ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 376 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRbp) 16 Public ctx_b 2) (va_QEmpty ((h)))))))))))))))))))))
val va_lemma_Poly1305_blocks : va_b0:va_code -> va_s0:va_state -> r:int -> h_in:int ->
ctx_b:buffer64 -> inp_b:buffer64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_blocks ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRdx va_s0 `op_Modulus` 16 == 0 /\
va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64 /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24 (va_get_mem_layout va_s0)
Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0)
inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout va_s0) Public /\ (let h0_in
= Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let r0_in =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let r1_in =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in h_in == va_mul_nat h2_in
(va_mul_nat n n) + va_mul_nat h1_in n + h0_in /\ r == va_mul_nat r1_in n + r0_in /\ r0_in < n
`op_Division` 16 /\ r1_in < n `op_Division` 16 /\ r1_in `op_Modulus` 4 == 0 /\ h2_in < 5 /\
va_get_reg64 rRcx va_s0 < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64
rRbp va_sM < 5 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64
rRdi va_sM) ctx_b 24 (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0
`op_Division` 8) (va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific
ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 2 /\ va_get_reg64 rR14 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbx va_sM
== Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbp va_sM
== Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR11 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR12 va_sM
== Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR13 va_sM
== va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRsi va_sM
== va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRcx va_sM == va_get_reg64
rRcx va_s0 /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 /\ (let r0_in =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) in let r1_in =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) in h == va_mul_nat
(va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM)
pow2_64 + va_get_reg64 rR14 va_sM /\ Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Util.poly1305_heap_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat
(va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r (Vale.X64.Decls.buffer64_as_seq
(va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0 `op_Division` 8))) /\ va_state_eq
va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM
(va_update_reg64 rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_blocks va_b0 va_s0 r h_in ctx_b inp_b =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64
rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64
rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64
rRdx; va_Mod_reg64 rRsi; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Poly1305_blocks va_mods r h_in ctx_b inp_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_blocks ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let h = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
pow2_64 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in label
va_range1
"***** POSTCONDITION NOT MET AT line 264 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 66 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 266 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_s0) inp_b
(va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout va_sM) Public) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 65 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet
1 va_sM) 0 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 268 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR14 va_sM == Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 269 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbx va_sM == Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM == Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR11 va_sM == Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR12 va_sM == Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM + va_get_reg64 rR12 va_sM `op_Division` 4)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 277 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 278 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 280 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_sM) in label
va_range1
"***** POSTCONDITION NOT MET AT line 281 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_sM) in label
va_range1
"***** POSTCONDITION NOT MET AT line 282 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64 pow2_64) + va_mul_nat
(va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0
`op_Division` 8)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
let h = va_g in
(va_sM, va_fM, h)
[@ va_qattr]
let va_wp_Poly1305_blocks (r:int) (h_in:int) (ctx_b:buffer64) (inp_b:buffer64) (va_s0:va_state)
(va_k:(va_state -> int -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64
in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64
rRdx va_s0 `op_Modulus` 16 == 0 /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
24 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8)
(va_get_mem_layout va_s0) Public /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0
(va_get_mem_heaplet 1 va_s0) in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1
(va_get_mem_heaplet 1 va_s0) in let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2
(va_get_mem_heaplet 1 va_s0) in let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3
(va_get_mem_heaplet 1 va_s0) in let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4
(va_get_mem_heaplet 1 va_s0) in h_in == va_mul_nat h2_in (va_mul_nat n n) + va_mul_nat h1_in n
+ h0_in /\ r == va_mul_nat r1_in n + r0_in /\ r0_in < n `op_Division` 16 /\ r1_in < n
`op_Division` 16 /\ r1_in `op_Modulus` 4 == 0 /\ h2_in < 5 /\ va_get_reg64 rRcx va_s0 < 2)) /\
(forall (va_x_mem:vale_heap) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_r10:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64)
(va_x_rbx:nat64) (va_x_rbp:nat64) (va_x_rax:nat64) (va_x_r15:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_heap1:vale_heap) (h:int) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_flags
va_x_efl (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rRbp va_x_rbp
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rRsi va_x_rsi (va_upd_mem va_x_mem va_s0))))))))))))))) in va_get_ok va_sM /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRbp va_sM < 5 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_sM)
(va_get_reg64 rRsi va_s0) inp_b (va_get_reg64 rRdx va_s0 `op_Division` 8) (va_get_mem_layout
va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) 0 2 /\ va_get_reg64 rR14 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 0 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbx va_sM == Vale.X64.Decls.buffer64_read
ctx_b 1 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rRbp va_sM == Vale.X64.Decls.buffer64_read
ctx_b 2 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR11 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 3 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR12 va_sM == Vale.X64.Decls.buffer64_read
ctx_b 4 (va_get_mem_heaplet 1 va_sM) /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR12 va_sM +
va_get_reg64 rR12 va_sM `op_Division` 4 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 +
va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRcx va_sM == va_get_reg64 rRcx va_s0 /\ va_get_reg64
rRdi va_sM == va_get_reg64 rRdi va_s0 /\ (let r0_in = Vale.X64.Decls.buffer64_read ctx_b 3
(va_get_mem_heaplet 1 va_sM) in let r1_in = Vale.X64.Decls.buffer64_read ctx_b 4
(va_get_mem_heaplet 1 va_sM) in h == va_mul_nat (va_get_reg64 rRbp va_sM) (va_mul_nat pow2_64
pow2_64) + va_mul_nat (va_get_reg64 rRbx va_sM) pow2_64 + va_get_reg64 rR14 va_sM /\
Vale.Poly1305.Spec_s.modp h == Vale.Poly1305.Util.poly1305_heap_blocks
(Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat (va_get_reg64 rRcx va_sM) (va_mul_nat n n)) r
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_sM) inp_b) (va_get_reg64 rRdx va_s0
`op_Division` 8))) ==> va_k va_sM ((h))))
val va_wpProof_Poly1305_blocks : r:int -> h_in:int -> ctx_b:buffer64 -> inp_b:buffer64 ->
va_s0:va_state -> va_k:(va_state -> int -> Type0)
-> Ghost (va_state & va_fuel & int)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_blocks r h_in ctx_b inp_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_blocks ())
([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax; va_Mod_reg64 rRbp;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_blocks r h_in ctx_b inp_b va_s0 va_k =
let (va_sM, va_f0, h) = va_lemma_Poly1305_blocks (va_code_Poly1305_blocks ()) va_s0 r h_in ctx_b
inp_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM (va_update_reg64
rR15 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rRax;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_mem]) va_sM va_s0;
let va_g = (h) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_blocks (r:int) (h_in:int) (ctx_b:buffer64) (inp_b:buffer64) : (va_quickCode
int (va_code_Poly1305_blocks ())) =
(va_QProc (va_code_Poly1305_blocks ()) ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15;
va_Mod_reg64 rRax; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_mem]) (va_wp_Poly1305_blocks r h_in ctx_b inp_b)
(va_wpProof_Poly1305_blocks r h_in ctx_b inp_b))
//--
//-- Poly1305_last_block
val va_code_Poly1305_last_block : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_last_block () =
(va_Block (va_CCons (va_IfElse (va_cmp_lt (va_op_cmp_reg64 rR15) (va_const_cmp 8)) (va_Block
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_CCons
(va_code_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_CCons (va_code_Shl64
(va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Sub64
(va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ())))))))))))))))) (va_Block
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR15)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
8)) (va_CCons (va_code_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_CCons (va_code_Shl64
(va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CCons (va_code_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_CNil ()))))))))))))))))))) (va_CCons
(va_code_Poly1305_iteration ()) (va_CNil ()))))
val va_codegen_success_Poly1305_last_block : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_last_block () =
(va_pbool_and (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRcx)
(va_const_shift_amt64 3)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_const_opr64 1)) (va_pbool_and (va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRdx)
(va_op_shift_amt64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rRcx) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64
rRcx) (va_const_opr64 1)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9)
(va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Adc64Wrap
(va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_pbool_and
(va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 8)) (va_pbool_and
(va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_pbool_and
(va_codegen_success_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rR8)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rR9)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbp) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64
rR14) (va_const_opr64 0)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64
rRbx) (va_op_opr64_reg64 rRdx)) (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbp)
(va_const_opr64 0))))))))))))))))))))))))))))) (va_pbool_and
(va_codegen_success_Poly1305_iteration ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_last_block (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_last_block ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r1:nat64) = va_get_reg64 rRax va_s in let
(r:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s) r1 in
let (hBlocks:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in let
(inpLast:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s)
(va_get_reg64 rR9 va_s) in let (padLast:Prims.pos) = Prims.pow2 (va_get_reg64 rR15 va_s
`op_Multiply` 8) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 409 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_lt (va_op_cmp_reg64 rR15) (va_const_cmp 8)) (qblock va_mods (fun
(va_s:va_state) -> let (va_arg78:Vale.Def.Types_s.nat64) = va_get_reg64 rR15 va_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 410 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_shift_power2 va_arg78) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 412 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 413 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 414 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 415 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdx va_s == padLast) (let (va_arg77:Vale.Def.Types_s.nat64) = va_get_reg64 rR15
va_s in let (va_arg76:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 417 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_and_mod va_arg76 va_arg77) (va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(padLast == Vale.Poly1305.Math.shift_left64 1 (Vale.Poly1305.Math.shift_left64 (va_get_reg64
rR15 va_s) 3)) (let (va_arg75:Prims.int) = Prims.pow2 (va_get_reg64 rR15 va_s `op_Multiply` 8)
in let (va_arg74:Prims.int) = va_get_reg64 rR15 va_s in let (va_arg73:Vale.Def.Types_s.nat64) =
va_get_reg64 rR9 va_s in let (va_arg72:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 420 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mod_power2_lo va_arg72 va_arg73 va_arg74 va_arg75)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 421 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 422 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR8 va_s == va_get_reg64 rR8 va_old_s `op_Modulus` padLast) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == inpLast
`op_Modulus` padLast) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 429 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 430 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 431 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 433 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 434 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 435 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QEmpty
(())))))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 437 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rR15 va_s - 8 >= 0 /\ va_get_reg64 rR15 va_s - 8 <= 255) (fun _ -> let
(nExtra8:nat8) = va_get_reg64 rR15 va_s - 8 in let (va_arg85:Vale.Def.Types_s.nat64) = nExtra8
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_shift_power2 va_arg85) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 441 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRcx) (va_const_shift_amt64 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 442 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 443 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shl64 (va_op_dst_opr64_reg64 rRdx) (va_op_shift_amt64_reg64 rRcx)) (fun
(va_s:va_state) _ -> va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(padLast == Vale.Poly1305.Math.lowerUpper128 0 (va_get_reg64 rRdx va_s)) (let
(va_arg84:Prims.nat) = 8 `op_Multiply` nExtra8 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 446 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_power2_add64 va_arg84) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 447 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg83:Vale.Def.Types_s.nat64) = nExtra8 in let (va_arg82:Vale.Def.Types_s.nat64) =
va_get_reg64 rR9 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 451 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_bytes_and_mod va_arg82 va_arg83) (va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 452 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Prims.pow2 (8 `op_Multiply` nExtra8) >= 0 /\ Prims.pow2 (8 `op_Multiply` nExtra8) <=
18446744073709551615) (fun _ -> let (va_arg81:Vale.Def.Types_s.nat64) = Prims.pow2 (8
`op_Multiply` nExtra8) in let (va_arg80:Vale.Def.Types_s.nat64) = va_get_reg64 rR9 va_s in let
(va_arg79:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 452 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_mod_hi va_arg79 va_arg80 va_arg81) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 453 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 454 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 455 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRcx)) (fun (va_s:va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 456 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == inpLast
`op_Modulus` padLast) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 459 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 460 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 461 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbp) (va_const_opr64 0)) (va_QEmpty
(()))))))))))))))))))))))))) (fun (va_s:va_state) va_g -> let (h:int) = hBlocks + inpLast
`op_Modulus` padLast + padLast in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 469 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == va_mul_nat (va_get_reg64 rRbp va_s) (va_mul_nat n n) + va_mul_nat (va_get_reg64 rRbx
va_s) n + va_get_reg64 rR14 va_s) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 469 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 469 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (va_qAssertBy
va_range1
"***** PRECONDITION NOT MET AT line 470 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == va_mul_nat r1 n + va_get_reg64 rR11 va_s) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 470 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 471 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_iteration r1) (fun (va_s:va_state) (hLast:int) -> va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 472 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(hLast == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 472 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 472 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg71:Prims.int) = r in let (va_arg70:Prims.int) = inpLast `op_Modulus` padLast + padLast
in let (va_arg69:Prims.pos) = p in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 473 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_demod va_arg69 hBlocks va_arg70 va_arg71)
(va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 474 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r)) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 474 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_QEmpty (()))) (va_QEmpty (()))))))))))
val va_lemma_Poly1305_last_block : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_last_block ()) va_s0 /\ va_get_ok va_s0 /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n
`op_Division` 16 /\ r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division`
4 /\ (1 <= va_get_reg64 rR15 va_s0 /\ va_get_reg64 rR15 va_s0 < 16))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
(p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_sM < 5 /\ (let padLast = Prims.pow2 (va_get_reg64 rR15 va_sM `op_Multiply`
8) in let hLast = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM) in
Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM va_s0)))))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_last_block va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_last_block va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_last_block ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 380 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 402 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRbp va_sM < 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let padLast = Prims.pow2 (va_get_reg64 rR15 va_sM `op_Multiply` 8) in label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let hLast = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64
rR14 va_sM) (va_get_reg64 rRbx va_sM)) (va_get_reg64 rRbp va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 405 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp ((Vale.Poly1305.Spec_s.modp
hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply` r)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_last_block (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in let
(r1:nat64) = va_get_reg64 rRax va_s0 in let (r:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in let (hBlocks:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0)
(va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let (inpLast:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0) (va_get_reg64 rR9 va_s0) in
va_get_reg64 rRbp va_s0 < 5 /\ va_get_reg64 rR11 va_s0 < n `op_Division` 16 /\ r1 < n
`op_Division` 16 /\ r1 `op_Modulus` 4 == 0 /\ va_get_reg64 rR13 va_s0 == r1 + r1 `op_Division`
4 /\ (1 <= va_get_reg64 rR15 va_s0 /\ va_get_reg64 rR15 va_s0 < 16)) /\ (forall
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_r8:nat64) (va_x_r9:nat64)
(va_x_r10:nat64) (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_rbp:nat64) (va_x_efl:Vale.X64.Flags.t)
. let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64
rR8 va_x_r8 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax
va_s0))))))))) in va_get_ok va_sM /\ (let (n:(va_int_range 18446744073709551616
18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
va_mul_nat n n `op_Multiply` 4 - 5 in let (r1:nat64) = va_get_reg64 rRax va_s0 in let
(r:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s0) r1 in
let (hBlocks:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in let
(inpLast:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s0)
(va_get_reg64 rR9 va_s0) in va_get_reg64 rRbp va_sM < 5 /\ (let padLast = Prims.pow2
(va_get_reg64 rR15 va_sM `op_Multiply` 8) in let hLast = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM) in Vale.Poly1305.Spec_s.modp hLast == Vale.Poly1305.Spec_s.modp
((Vale.Poly1305.Spec_s.modp hBlocks + padLast + inpLast `op_Modulus` padLast) `op_Multiply`
r))) ==> va_k va_sM (())))
val va_wpProof_Poly1305_last_block : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_last_block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_last_block ())
([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_last_block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_last_block (va_code_Poly1305_last_block ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_last_block () : (va_quickCode unit (va_code_Poly1305_last_block ())) =
(va_QProc (va_code_Poly1305_last_block ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax]) va_wp_Poly1305_last_block va_wpProof_Poly1305_last_block)
//--
//-- Poly1305_reduce_last
val va_code_Poly1305_reduce_last : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_reduce_last () =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_CCons
(va_code_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_CCons (va_code_Adc64Wrap
(va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (va_CCons (va_code_Shr64
(va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_Sub64Wrap
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 1)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 0)) (va_CCons (va_code_Sub64Wrap
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_And64
(va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Add64
(va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Add64
(va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_CNil ())))))))))))))))))))
val va_codegen_success_Poly1305_reduce_last : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_reduce_last () =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp))
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10))
(va_pbool_and (va_codegen_success_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_const_opr64 1))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 0))
(va_pbool_and (va_codegen_success_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64
rR10)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rR8)) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64
rR9)) (va_ttrue ()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_reduce_last (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_reduce_last ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Prims.int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 490 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 492 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rR14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 493 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 494 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rRbp)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 495 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR8) (va_const_opr64 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 496 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR9) (va_const_opr64 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 497 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rR10) (va_const_opr64 0)) (fun (va_s:va_state) _ ->
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 499 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h + 5 == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8
va_s) (va_get_reg64 rR9 va_s)) (va_get_reg64 rR10 va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 500 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 500 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_QEmpty (())))) (let
(va_arg32:Vale.Def.Types_s.nat64) = va_get_reg64 rR8 va_s in let
(va_arg31:Vale.Def.Types_s.nat64) = va_get_reg64 rR9 va_s in let
(va_arg30:Vale.Def.Types_s.nat64) = va_get_reg64 rR10 va_s in let (va_arg29:Prims.int) = h + 5
in let (va_arg28:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_old_s in let
(va_arg27:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_old_s in let
(va_arg26:Vale.Def.Types_s.nat64) = va_get_reg64 rRbp va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 501 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_reduce128 h va_arg26 va_arg27 va_arg28 va_arg29
va_arg30 va_arg31 va_arg32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Shr64 (va_op_dst_opr64_reg64 rR10) (va_const_shift_amt64 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 506 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_const_opr64 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 509 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 511 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64Wrap (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 514 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 515 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 518 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 519 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rR9)) (va_QEmpty
(())))))))))))))))))))))))
val va_lemma_Poly1305_reduce_last : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_reduce_last ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in va_get_reg64
rRbp va_s0 < 5)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0)) (va_get_reg64 rRbp va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rR8 va_sM (va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_reduce_last va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_reduce_last va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_reduce_last ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 478 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 488 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_reduce_last (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in va_get_reg64 rRbp va_s0 < 5) /\ (forall (va_x_r8:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_rax:nat64) (va_x_r14:nat64) (va_x_rbx:nat64)
(va_x_rbp:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rRbp va_x_rbp (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rRax
va_x_rax (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8
va_s0))))))) in va_get_ok va_sM /\ (let (h:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0))
(va_get_reg64 rRbp va_s0) in Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM)
(va_get_reg64 rRbx va_sM) == Vale.Poly1305.Spec_s.mod2_128 (Vale.Poly1305.Spec_s.modp h)) ==>
va_k va_sM (())))
val va_wpProof_Poly1305_reduce_last : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_reduce_last va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_reduce_last ())
([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_reg64 rRax;
va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_reduce_last va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_reduce_last (va_code_Poly1305_reduce_last ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbp va_sM (va_update_reg64
rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rR14;
va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_reduce_last () : (va_quickCode unit (va_code_Poly1305_reduce_last ())) =
(va_QProc (va_code_Poly1305_reduce_last ()) ([va_Mod_flags; va_Mod_reg64 rRbp; va_Mod_reg64 rRbx;
va_Mod_reg64 rR14; va_Mod_reg64 rRax; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8])
va_wp_Poly1305_reduce_last va_wpProof_Poly1305_reduce_last)
//--
//-- Poly1305_add_key_s
val va_code_Poly1305_add_key_s : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_add_key_s () =
(va_Block (va_CCons (va_code_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax))
(va_CCons (va_code_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (va_CNil
()))))
val va_codegen_success_Poly1305_add_key_s : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_add_key_s () =
(va_pbool_and (va_codegen_success_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Adc64Wrap (va_op_dst_opr64_reg64 rRbx)
(va_op_opr64_reg64 rRdx)) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_add_key_s (va_mods:va_mods_t) : (va_quickCode unit
(va_code_Poly1305_add_key_s ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s) (va_get_reg64 rRdx va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 536 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Add64Wrap (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRax)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 537 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Adc64Wrap (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdx)) (fun (va_s:va_state)
_ -> let (va_arg18:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_s in let
(va_arg17:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_s in let (va_arg16:Prims.int) = key_s
in let (va_arg15:Vale.Def.Types_s.nat64) = va_get_reg64 rRdx va_s in let
(va_arg14:Vale.Def.Types_s.nat64) = va_get_reg64 rRax va_s in let (va_arg13:Prims.int) = h_in
in let (va_arg12:Vale.Def.Types_s.nat64) = va_get_reg64 rRbx va_old_s in let
(va_arg11:Vale.Def.Types_s.nat64) = va_get_reg64 rR14 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 539 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_add_key va_arg11 va_arg12 va_arg13 va_arg14 va_arg15
va_arg16 va_arg17 va_arg18) (va_QEmpty (()))))))
val va_lemma_Poly1305_add_key_s : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Poly1305_add_key_s ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rR14 va_sM (va_update_ok va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Poly1305_add_key_s va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_ok] in
let va_qc = va_qcode_Poly1305_add_key_s va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Poly1305_add_key_s ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 523 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\ (let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 534 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Poly1305_add_key_s (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_r14:nat64) (va_x_rbx:nat64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rR14 va_x_r14 va_s0))
in va_get_ok va_sM /\ (let (h_in:Vale.Def.Words_s.nat128) = Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_s0) (va_get_reg64 rRbx va_s0) in let (key_s:Vale.Def.Words_s.nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rRax va_s0) (va_get_reg64 rRdx va_s0) in
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM) ==
Vale.Poly1305.Spec_s.mod2_128 (h_in + key_s)) ==> va_k va_sM (())))
val va_wpProof_Poly1305_add_key_s : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Poly1305_add_key_s va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Poly1305_add_key_s ()) ([va_Mod_flags;
va_Mod_reg64 rRbx; va_Mod_reg64 rR14]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Poly1305_add_key_s va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Poly1305_add_key_s (va_code_Poly1305_add_key_s ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rRbx va_sM (va_update_reg64
rR14 va_sM (va_update_ok va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Poly1305_add_key_s () : (va_quickCode unit (va_code_Poly1305_add_key_s ())) =
(va_QProc (va_code_Poly1305_add_key_s ()) ([va_Mod_flags; va_Mod_reg64 rRbx; va_Mod_reg64 rR14])
va_wp_Poly1305_add_key_s va_wpProof_Poly1305_add_key_s)
//--
// REVIEW: not clear why Vale.Def.TypesNative_s.reveal_iand doesn't work directly
let reveal_logand128 (x y:nat128) : Lemma
(requires True)
(ensures Vale.Def.Types_s.iand x y == FStar.UInt.logand #128 x y)
= Vale.Def.TypesNative_s.reveal_iand 128 x y
//-- reveal_logand128
//--
//-- Poly1305_impl
val va_code_Poly1305_impl : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Poly1305_impl () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64
rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rRdi) 32
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1152921487695413247)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64
rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1152921487695413244)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64
rRcx)) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRdi) (va_op_reg_opr64_reg64 rR11) 24 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR12) 32
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx))
(va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_CCons
(va_code_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRdx) 64
Public) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (va_CCons
(va_code_Poly1305_blocks ()) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdi) 184 Public) (va_CCons (va_IfElse
(va_cmp_eq (va_op_cmp_reg64 rRax) (va_const_cmp 1)) (va_Block (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15) (va_op_reg_opr64_reg64 rRdi) 56
Public) (va_CCons (va_IfElse (va_cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (va_Block
(va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsi) 0
Public) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rR9) (va_op_reg_opr64_reg64 rRsi) 8 Public) (va_CCons (va_code_Poly1305_last_block ()) (va_CNil
())))))) (va_Block (va_CNil ()))) (va_CCons (va_code_Poly1305_reduce_last ()) (va_CCons
(va_code_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 40 Public) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRdi) 48
Public) (va_CCons (va_code_Poly1305_add_key_s ()) (va_CNil ())))))))) (va_Block (va_CNil ())))
(va_CNil ())))))))))))))))))))
val va_codegen_success_Poly1305_impl : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Poly1305_impl () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rR11) (va_op_reg_opr64_reg64 rRdi) 24 Public) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413247)) (va_pbool_and
(va_codegen_success_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRcx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413244))
(va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rR11) 24 Public) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR12) 32 Public) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_And64
(va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_pbool_and (va_codegen_success_Sub64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRdx) 64
Public) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64
1)) (va_pbool_and (va_codegen_success_Poly1305_blocks ()) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 184 Public) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRdi) 56 Public) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsi) 0
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRsi) 8 Public)
(va_codegen_success_Poly1305_last_block ())))) (va_pbool_and
(va_codegen_success_Poly1305_reduce_last ()) (va_pbool_and (va_codegen_success_Load64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdi) 40
Public) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRdi) 48 Public)
(va_codegen_success_Poly1305_add_key_s ())))))) (va_ttrue ()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Poly1305_impl (va_mods:va_mods_t) (key_r:nat128) (key_s:nat128) (ctx_b:buffer64)
(inp_b:buffer64) (finish:nat64) : (va_quickCode (int) (va_code_Poly1305_impl ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:(va_int_range
18446744073709551616 18446744073709551616)) = pow2_64 in let (inp_in:nat64) = va_get_reg64 rRsi
va_s in let (len_in:nat64) = va_get_reg64 rRdx va_s in let (h0_in:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s) in let
(h1_in:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1
va_s) in let (h2_in:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 2
(va_get_mem_heaplet 1 va_s) in let (h_in:Prims.int) = Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let (key_r0:Vale.Def.Types_s.nat64) =
Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s) in let
(key_r1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1
va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 607 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 609 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR11)
(va_op_reg_opr64_reg64 rRdi) 24 Public ctx_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 610 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR12)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 611 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413247)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 612 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 613 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1152921487695413244)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 614 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 615 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR11) 24 Public ctx_b 3) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 616 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rR12) 32 Public ctx_b 4) (fun (va_s:va_state) _ -> let (r:nat128) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR11 va_s) (va_get_reg64 rR12 va_s) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 619 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == va_get_reg64 rR11 va_s + va_mul_nat n (va_get_reg64 rR12 va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 619 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (let
(mask:nat128) = 21267647620597763993911028882763415551 in va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 622 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == Vale.Arch.Types.iand128 key_r mask) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 624 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (let
(va_arg81:Vale.Def.Types_s.nat64) = va_get_reg64 rR12 va_s in let
(va_arg80:Vale.Def.Types_s.nat64) = va_get_reg64 rR11 va_s in let
(va_arg79:Vale.Def.Words_s.nat128) = r in let (va_arg78:Vale.Def.Words_s.nat128) = mask in let
(va_arg77:Vale.Def.Words_s.nat128) = key_r in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 625 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_lowerUpper128_and va_arg77 key_r0 key_r1 va_arg78
1152921487695413247 1152921487695413244 va_arg79 va_arg80 va_arg81) (va_QEmpty (())))) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 629 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 630 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rRax) (va_const_opr64 15)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 631 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 634 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 56 Public ctx_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 635 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRdx) 64 Public ctx_b 8) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 637 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_const_opr64 1)) (fun (va_s:va_state) _ ->
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 638 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h_in == va_mul_nat h2_in (va_mul_nat n n) + va_mul_nat h1_in n + h0_in) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 638 column 81 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 638 column 105 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_QEmpty (())))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 639 column 7 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_blocks r h_in ctx_b inp_b) (fun (va_s:va_state) (h:int) -> va_qAssertBy
va_range1
"***** PRECONDITION NOT MET AT line 640 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14
va_s) (va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s)) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 641 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper192_reveal ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 641 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (())))) (let
(va_arg76:Prims.int) = va_get_reg64 rRdx va_old_s `op_Division` 16 in let
(va_arg75:Vale.X64.Memory.buffer64) = inp_b in let (va_arg74:Vale.X64.Memory.vale_heap) =
va_get_mem_heaplet 0 va_s in let (va_arg73:Prims.int) = r in let (va_arg72:Prims.int) =
va_mul_nat n n in let (va_arg71:Prims.int) = Vale.Poly1305.Spec_s.modp h_in in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 642 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Util.lemma_poly1305_heap_hash_blocks_alt va_arg71 va_arg72
va_arg73 va_arg74 va_arg75 va_arg76) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 644 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 184 Public ctx_b 23) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 645 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_eq (va_op_cmp_reg64 rRax) (va_const_cmp 1)) (qblock va_mods (fun
(va_s:va_state) -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 647 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> reveal_logand128 key_r mask) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 648 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(r == Vale.Poly1305.Math.bare_r key_r) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 650 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRdi) 56 Public ctx_b 7) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 652 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_qIf va_mods (Cmp_ne (va_op_cmp_reg64 rR15) (va_const_cmp 0)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 654 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 32 Public ctx_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 655 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR8)
(va_op_reg_opr64_reg64 rRsi) 0 Public inp_b (len_in `op_Division` 16 `op_Multiply` 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 656 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRsi) 8 Public inp_b (len_in `op_Division` 16 `op_Multiply` 2 + 1)) (fun
(va_s:va_state) _ -> let (a:Vale.X64.Machine_s.nat128) = Vale.Poly1305.Util.seqTo128_app
(Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s) inp_b) (len_in `op_Division` 16) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 658 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR8 va_s) (va_get_reg64 rR9 va_s) == a)
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 659 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lowerUpper128_reveal ()) (va_QEmpty (()))) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 660 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_last_block ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s)
(va_get_reg64 rRbx va_s)) (va_get_reg64 rRbp va_s) in va_QEmpty ((h))))))))) (qblock va_mods
(fun (va_s:va_state) -> va_QEmpty ((h))))) (fun (va_s:va_state) va_g -> let (h:int) = va_g in
let (va_arg70:Prims.int) = key_s in let (va_arg69:Prims.int) = Vale.Poly1305.Spec_s.modp h in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 664 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_add_mod128 va_arg69 va_arg70) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 665 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_reduce_last ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 668 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdi) 40 Public ctx_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 669 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRdi) 48 Public ctx_b 6) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 670 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_quick_Poly1305_add_key_s ()) (fun (va_s:va_state) _ -> let (h:int) =
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_s) (va_get_reg64 rRbx va_s) in
va_qAssertBy va_range1
"***** PRECONDITION NOT MET AT line 673 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in) key_r key_s
(Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0 va_s)
inp_b)) len_in) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 674 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%mod2_128) mod2_128 mod2_128) (fun _ -> va_reveal_opaque
(`%mod2_128) mod2_128) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 674 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
true (fun _ -> va_reveal_eq (`%modp) modp modp) (fun _ -> va_reveal_opaque (`%modp) modp)
(va_QEmpty (())))) (va_QEmpty ((h)))))))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((h))))) (fun (va_s:va_state) va_g -> let (h:int) = va_g in va_QEmpty
((h)))))))))))))))))))))))))))
val va_lemma_Poly1305_impl : va_b0:va_code -> va_s0:va_state -> key_r:nat128 -> key_s:nat128 ->
ctx_b:buffer64 -> inp_b:buffer64 -> finish:nat64
-> Ghost (va_state & va_fuel & int)
(requires (va_require_total va_b0 (va_code_Poly1305_impl ()) va_s0 /\ va_get_ok va_s0 /\ (let
(n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 24
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRsi va_s0) inp_b (Vale.Poly1305.Util.readable_words (va_get_reg64 rRdx va_s0))
(va_get_mem_layout va_s0) Public /\ va_get_reg64 rRsi va_s0 + va_get_reg64 rRdx va_s0 < pow2_64
/\ (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let key_r0
= Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem_heaplet 1 va_s0) in let key_r1 =
Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem_heaplet 1 va_s0) in let key_s0 =
Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem_heaplet 1 va_s0) in let key_s1 =
Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem_heaplet 1 va_s0) in finish ==
Vale.X64.Decls.buffer64_read ctx_b 23 (va_get_mem_heaplet 1 va_s0) /\ key_r ==
Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 /\ key_s == Vale.Poly1305.Math.lowerUpper128
key_s0 key_s1 /\ h2_in < 5 /\ finish < 2))))
(ensures (fun (va_sM, va_fM, h) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (n:(va_int_range 18446744073709551616 18446744073709551616)) = pow2_64 in
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rRdi va_sM) ctx_b 24
(va_get_mem_layout va_sM) Public /\ Vale.X64.Decls.modifies_buffer_specific ctx_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) 0 8 /\ (let h0_in =
Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in let h1_in =
Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0) in let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet 0
va_sM) inp_b) in (finish == 0 ==> h == Vale.Poly1305.Math.lowerUpper192
(Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\ (finish == 0 ==> Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r) inp_mem (va_get_reg64 rRdx va_s0 `op_Division` 16)) /\
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\ (finish == 1 ==> h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM) (va_get_reg64 rRbx va_sM)) /\
(finish == 1 ==> h == Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
key_r key_s inp_mem (va_get_reg64 rRdx va_s0)) /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi
va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
(va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRbx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Poly1305.Util.fsti.checked",
"Vale.Poly1305.Spec_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.TypesNative_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Poly1305.X64.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Spec_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Spec_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
key_r: Vale.X64.Machine_s.nat128 ->
key_s: Vale.X64.Machine_s.nat128 ->
ctx_b: Vale.X64.Memory.buffer64 ->
inp_b: Vale.X64.Memory.buffer64 ->
finish: Vale.X64.Memory.nat64
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.int) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.X64.Machine_s.nat128",
"Vale.X64.Memory.buffer64",
"Vale.X64.Memory.nat64",
"Vale.X64.QuickCodes.fuel",
"Prims.int",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.Decls.va_fuel",
"Prims.unit",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Machine_s.rR14",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.Poly1305.X64.va_code_Poly1305_impl",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.Decls.validSrcAddrs64",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Decls.modifies_buffer_specific",
"Prims.l_imp",
"Vale.Poly1305.Math.lowerUpper192",
"Vale.Poly1305.Math.lowerUpper128",
"Vale.Poly1305.Spec_s.modp",
"Vale.Poly1305.Spec_s.poly1305_hash_blocks",
"Vale.X64.Decls.va_mul_nat",
"Vale.Poly1305.Spec_s.make_r",
"Prims.op_Division",
"Prims.op_LessThan",
"Vale.Poly1305.Spec_s.poly1305_hash_all",
"Vale.Def.Types_s.nat64",
"Vale.Poly1305.Util.t_seqTo128",
"Vale.Poly1305.Util.seqTo128",
"Vale.X64.Decls.buffer64_as_seq",
"Vale.Def.Words_s.nat64",
"Vale.X64.Decls.buffer64_read",
"Vale.X64.Decls.va_int_range",
"Vale.X64.Machine_s.pow2_64",
"Vale.X64.QuickCode.quickCode",
"Vale.Poly1305.X64.va_qcode_Poly1305_impl"
] | [] | false | false | false | false | false | let va_lemma_Poly1305_impl va_b0 va_s0 key_r key_s ctx_b inp_b finish =
| let va_mods:va_mods_t =
[
va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem
]
in
let va_qc = va_qcode_Poly1305_impl va_mods key_r key_s ctx_b inp_b finish in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Poly1305_impl ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let h = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 551 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_ok va_sM) /\
(let n:(va_int_range 18446744073709551616 18446744073709551616) = pow2_64 in
label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 66 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 1 va_sM)
(va_get_reg64 rRdi va_sM)
ctx_b
24
(va_get_mem_layout va_sM)
Public) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 65 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(Vale.X64.Decls.modifies_buffer_specific ctx_b
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)
0
8) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem_heaplet 1 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem_heaplet 1 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h2_in =
Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem_heaplet 1 va_s0)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let h_in =
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in
h1_in)
h2_in
in
label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(let inp_mem =
Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem_heaplet
0
va_sM)
inp_b)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 591 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==>
h ==
Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128
(va_get_reg64 rR14 va_sM)
(va_get_reg64 rRbx va_sM))
(va_get_reg64 rRbp va_sM)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 593 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==>
Vale.Poly1305.Spec_s.modp h ==
Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp
h_in)
(va_mul_nat n n)
(Vale.Poly1305.Spec_s.make_r key_r)
inp_mem
((va_get_reg64 rRdx va_s0) `op_Division` 16)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 594 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 0 ==> va_get_reg64 rRbp va_sM < 5) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 595 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==>
h ==
Vale.Poly1305.Math.lowerUpper128 (va_get_reg64 rR14 va_sM)
(va_get_reg64 rRbx va_sM)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 596 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(finish == 1 ==>
h ==
Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in
)
key_r
key_s
inp_mem
(va_get_reg64 rRdx va_s0)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 597 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/poly1305/x64/Vale.Poly1305.X64.vaf *****"
(va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0))))))))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;
va_Mod_reg64 rRbp; va_Mod_reg64 rRbx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem
])
va_sM
va_s0;
let h = va_g in
(va_sM, va_fM, h) | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_and'_forall_no_repeats | val pairwise_and'_forall_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ L.no_repeats_p l)
(ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\ L.memP y l /\ x =!= y ==> f x y))) | val pairwise_and'_forall_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ L.no_repeats_p l)
(ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\ L.memP y l /\ x =!= y ==> f x y))) | let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 104,
"start_col": 0,
"start_line": 98
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma
(requires FStar.BigOps.symmetric f /\ FStar.List.Tot.Base.no_repeats_p l)
(ensures
FStar.BigOps.pairwise_and' f l <==>
(forall (x: a) (y: a).
FStar.List.Tot.Base.memP x l /\ FStar.List.Tot.Base.memP y l /\ ~(x == y) ==> f x y)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_and'_nil",
"FStar.BigOps.big_and'_forall",
"Prims.unit",
"FStar.BigOps.pairwise_and'_forall_no_repeats",
"FStar.BigOps.pairwise_and'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec pairwise_and'_forall_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_and'_nil f
| hd :: tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_or'_prop | val pairwise_or'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma ((pairwise_or' f l) `subtype_of` unit) | val pairwise_or'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma ((pairwise_or' f l) `subtype_of` unit) | let pairwise_or'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl -> pairwise_or'_cons f hd tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 116,
"start_col": 0,
"start_line": 113
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl
let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_or'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_or' f [] == False) by (T.compute())
let pairwise_or'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_or' f (hd::tl) == (big_or' (f hd) tl \/ pairwise_or' f tl)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (ensures Prims.subtype_of (FStar.BigOps.pairwise_or' f l) Prims.unit) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_or'_nil",
"FStar.BigOps.pairwise_or'_cons",
"Prims.unit"
] | [] | false | false | true | false | false | let pairwise_or'_prop (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_or'_nil f
| hd :: tl -> pairwise_or'_cons f hd tl | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_and'_forall | val pairwise_and'_forall (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ reflexive f)
(ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\ L.memP y l ==> f x y))) | val pairwise_and'_forall (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ reflexive f)
(ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\ L.memP y l ==> f x y))) | let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 96,
"start_col": 0,
"start_line": 90
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (requires FStar.BigOps.symmetric f /\ FStar.BigOps.reflexive f)
(ensures
FStar.BigOps.pairwise_and' f l <==>
(forall (x: a) (y: a).
FStar.List.Tot.Base.memP x l /\ FStar.List.Tot.Base.memP y l ==> f x y)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_and'_nil",
"FStar.BigOps.big_and'_forall",
"Prims.unit",
"FStar.BigOps.pairwise_and'_forall",
"FStar.BigOps.pairwise_and'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec pairwise_and'_forall (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_and'_nil f
| hd :: tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl | false |
FStar.BigOps.fst | FStar.BigOps.big_and'_forall | val big_and'_forall (#a: Type) (f: (a -> Type)) (l: list a)
: Lemma (big_and' f l <==> (forall x. L.memP x l ==> f x)) | val big_and'_forall (#a: Type) (f: (a -> Type)) (l: list a)
: Lemma (big_and' f l <==> (forall x. L.memP x l ==> f x)) | let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 59,
"end_line": 48,
"start_col": 0,
"start_line": 45
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma
(ensures FStar.BigOps.big_and' f l <==> (forall (x: a). FStar.List.Tot.Base.memP x l ==> f x)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"Prims.unit",
"FStar.BigOps.big_and'_nil",
"FStar.BigOps.big_and'_forall",
"FStar.BigOps.big_and'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec big_and'_forall (#a: Type) (f: (a -> Type)) (l: list a) =
| match l with
| [] ->
big_and'_nil f;
()
| hd :: tl ->
big_and'_cons f hd tl;
big_and'_forall f tl | false |
FStar.BigOps.fst | FStar.BigOps.big_or'_exists | val big_or'_exists (#a: Type) (f: (a -> Type)) (l: list a)
: Lemma (big_or' f l <==> (exists x. L.memP x l /\ f x)) | val big_or'_exists (#a: Type) (f: (a -> Type)) (l: list a)
: Lemma (big_or' f l <==> (exists x. L.memP x l /\ f x)) | let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 57,
"end_line": 65,
"start_col": 0,
"start_line": 62
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma
(ensures FStar.BigOps.big_or' f l <==> (exists (x: a). FStar.List.Tot.Base.memP x l /\ f x)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"Prims.unit",
"FStar.BigOps.big_or'_nil",
"FStar.BigOps.big_or'_exists",
"FStar.BigOps.big_or'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec big_or'_exists (#a: Type) (f: (a -> Type)) (l: list a) =
| match l with
| [] ->
big_or'_nil f;
()
| hd :: tl ->
big_or'_cons f hd tl;
big_or'_exists f tl | false |
FStar.Algebra.CommMonoid.Fold.Nested.fst | FStar.Algebra.CommMonoid.Fold.Nested.matrix_seq | val matrix_seq : generator: FStar.Matrix.matrix_generator c m r
-> s:
FStar.Seq.Base.seq c
{ FStar.Seq.Base.length s = m * r /\
(forall (ij: FStar.IntegerIntervals.under (m * r)).
FStar.Seq.Base.index s ij ==
FStar.Seq.Base.index s
(FStar.Matrix.get_ij m r (FStar.Matrix.get_i m r ij) (FStar.Matrix.get_j m r ij))) } | let matrix_seq #c #m #r (generator: matrix_generator c m r) =
seq_of_matrix (Matrix.init generator) | {
"file_name": "ulib/FStar.Algebra.CommMonoid.Fold.Nested.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 34,
"start_col": 0,
"start_line": 33
} | (*
Copyright 2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
(*
Here we reason about nested folds of functions over arbitrary
integer intervals. We call such functions generators.
*)
module FStar.Algebra.CommMonoid.Fold.Nested
module CF = FStar.Algebra.CommMonoid.Fold
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.IntegerIntervals
open FStar.Matrix | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Permutation.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Matrix.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Fold.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Algebra.CommMonoid.Fold.Nested.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": "CF"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": "CF"
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 | generator: FStar.Matrix.matrix_generator c m r
-> s:
FStar.Seq.Base.seq c
{ FStar.Seq.Base.length s = m * r /\
(forall (ij: FStar.IntegerIntervals.under (m * r)).
FStar.Seq.Base.index s ij ==
FStar.Seq.Base.index s
(FStar.Matrix.get_ij m r (FStar.Matrix.get_i m r ij) (FStar.Matrix.get_j m r ij))) } | Prims.Tot | [
"total"
] | [] | [
"Prims.pos",
"FStar.Matrix.matrix_generator",
"FStar.Matrix.seq_of_matrix",
"FStar.Matrix.init",
"FStar.Seq.Base.seq",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Multiply",
"Prims.l_Forall",
"FStar.IntegerIntervals.under",
"Prims.eq2",
"FStar.Seq.Base.index",
"FStar.Matrix.get_ij",
"FStar.Matrix.get_i",
"FStar.Matrix.get_j"
] | [] | false | false | false | false | false | let matrix_seq #c #m #r (generator: matrix_generator c m r) =
| seq_of_matrix (Matrix.init generator) | false |
|
FStar.BigOps.fst | FStar.BigOps.pairwise_or'_cons | val pairwise_or'_cons (#a: Type) (f: (a -> a -> Type0)) (hd: a) (tl: list a)
: Lemma (pairwise_or' f (hd :: tl) == (big_or' (f hd) tl \/ pairwise_or' f tl)) | val pairwise_or'_cons (#a: Type) (f: (a -> a -> Type0)) (hd: a) (tl: list a)
: Lemma (pairwise_or' f (hd :: tl) == (big_or' (f hd) tl \/ pairwise_or' f tl)) | let pairwise_or'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_or' f (hd::tl) == (big_or' (f hd) tl \/ pairwise_or' f tl)) | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 80,
"end_line": 111,
"start_col": 0,
"start_line": 110
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl
let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_or'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_or' f [] == False) by (T.compute()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> hd: a -> tl: Prims.list a
-> FStar.Pervasives.Lemma
(ensures
FStar.BigOps.pairwise_or' f (hd :: tl) ==
(FStar.BigOps.big_or' (f hd) tl \/ FStar.BigOps.pairwise_or' f tl)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"Prims._assert",
"Prims.eq2",
"FStar.BigOps.pairwise_or'",
"Prims.Cons",
"Prims.l_or",
"FStar.BigOps.big_or'",
"Prims.unit"
] | [] | true | false | true | false | false | let pairwise_or'_cons (#a: Type) (f: (a -> a -> Type)) (hd: a) (tl: list a) =
| assert (pairwise_or' f (hd :: tl) == (big_or' (f hd) tl \/ pairwise_or' f tl)) | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_or'_exists_no_repeats | val pairwise_or'_exists_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ L.no_repeats_p l)
(ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\ L.memP y l /\ x =!= y /\ f x y))) | val pairwise_or'_exists_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ L.no_repeats_p l)
(ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\ L.memP y l /\ x =!= y /\ f x y))) | let rec pairwise_or'_exists_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl ->
pairwise_or'_cons f hd tl;
pairwise_or'_exists_no_repeats f tl;
big_or'_exists (f hd) tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 132,
"start_col": 0,
"start_line": 126
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl
let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_or'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_or' f [] == False) by (T.compute())
let pairwise_or'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_or' f (hd::tl) == (big_or' (f hd) tl \/ pairwise_or' f tl))
let pairwise_or'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl -> pairwise_or'_cons f hd tl
let rec pairwise_or'_exists (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl ->
pairwise_or'_cons f hd tl;
pairwise_or'_exists f tl;
big_or'_exists (f hd) tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma
(requires FStar.BigOps.symmetric f /\ FStar.List.Tot.Base.no_repeats_p l)
(ensures
FStar.BigOps.pairwise_or' f l <==>
(exists (x: a) (y: a).
FStar.List.Tot.Base.memP x l /\ FStar.List.Tot.Base.memP y l /\ ~(x == y) /\ f x y)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_or'_nil",
"FStar.BigOps.big_or'_exists",
"Prims.unit",
"FStar.BigOps.pairwise_or'_exists_no_repeats",
"FStar.BigOps.pairwise_or'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec pairwise_or'_exists_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_or'_nil f
| hd :: tl ->
pairwise_or'_cons f hd tl;
pairwise_or'_exists_no_repeats f tl;
big_or'_exists (f hd) tl | false |
FStar.BigOps.fst | FStar.BigOps.pairwise_or'_exists | val pairwise_or'_exists (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ anti_reflexive f)
(ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\ L.memP y l /\ f x y))) | val pairwise_or'_exists (#a: Type) (f: (a -> a -> Type)) (l: list a)
: Lemma (requires symmetric f /\ anti_reflexive f)
(ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\ L.memP y l /\ f x y))) | let rec pairwise_or'_exists (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl ->
pairwise_or'_cons f hd tl;
pairwise_or'_exists f tl;
big_or'_exists (f hd) tl | {
"file_name": "ulib/FStar.BigOps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 124,
"start_col": 0,
"start_line": 118
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.BigOps
module T = FStar.Tactics.V2
let normal_eq (#a:Type) (f:a)
= ()
////////////////////////////////////////////////////////////////////////////////
let map_op'_nil
(#a:Type) (#b:Type) (#c:Type)
(op:b -> c -> GTot c) (f:a -> GTot b) (z:c)
: Lemma (map_op' op f [] z == z)
= ()
let map_op'_cons #a #b #c (op:b -> c -> GTot c) (f:a -> GTot b) (hd:a) (tl:list a) (z:c)
: Lemma (map_op' op f (hd::tl) z == f hd `op` map_op' op f tl z)
= ()
////////////////////////////////////////////////////////////////////////////////
let big_and'_nil (#a:Type) (f:a -> Type)
= assert (big_and' f [] == True) by (T.compute())
let big_and'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_and' f (hd :: tl) == (f hd /\ big_and' f tl)) by (T.compute())
let big_and'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f
| hd::tl -> big_and'_cons f hd tl
let rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_and'_nil f; ()
| hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl
////////////////////////////////////////////////////////////////////////////////
let big_or'_nil (#a:Type) (f:a -> Type)
= assert (big_or' f [] == False) by (T.compute())
let big_or'_cons (#a:Type) (f:a -> Type) (hd:a) (tl:list a)
= assert (big_or' f (hd :: tl) == (f hd \/ big_or' f tl)) by (T.compute())
let big_or'_prop (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f
| hd::tl -> big_or'_cons f hd tl
let rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)
= match l with
| [] -> big_or'_nil f; ()
| hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_and'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_and' f [] == True) by (T.compute())
let pairwise_and'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_and' f (hd::tl) == (big_and' (f hd) tl /\ pairwise_and' f tl))
by (T.trefl())
let pairwise_and'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl -> pairwise_and'_cons f hd tl
(* Note, this is good example of where the difference between
the implicitly and explicitly reducing variants of the definitions
makes a difference.
Proving this lemma directly on the `pairwise_and` is much harder
since one has to reason about many partially reduced forms.
Instead, we first prove the lemma on the non-reducing primed
version of the definition, and then obtain the lemma we want
at the end using `normal_eq` *)
let rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall f tl;
big_and'_forall (f hd) tl
let rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_and'_nil f
| hd::tl ->
pairwise_and'_cons f hd tl;
pairwise_and'_forall_no_repeats f tl;
big_and'_forall (f hd) tl
////////////////////////////////////////////////////////////////////////////////
let pairwise_or'_nil (#a:Type) (f:a -> a -> Type0)
= assert (pairwise_or' f [] == False) by (T.compute())
let pairwise_or'_cons (#a:Type) (f:a -> a -> Type) (hd:a) (tl:list a)
= assert (pairwise_or' f (hd::tl) == (big_or' (f hd) tl \/ pairwise_or' f tl))
let pairwise_or'_prop (#a:Type) (f:a -> a -> Type) (l:list a)
= match l with
| [] -> pairwise_or'_nil f
| hd::tl -> pairwise_or'_cons f hd tl | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.BigOps.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"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 | f: (_: a -> _: a -> Type0) -> l: Prims.list a
-> FStar.Pervasives.Lemma (requires FStar.BigOps.symmetric f /\ FStar.BigOps.anti_reflexive f)
(ensures
FStar.BigOps.pairwise_or' f l <==>
(exists (x: a) (y: a). FStar.List.Tot.Base.memP x l /\ FStar.List.Tot.Base.memP y l /\ f x y
)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.BigOps.pairwise_or'_nil",
"FStar.BigOps.big_or'_exists",
"Prims.unit",
"FStar.BigOps.pairwise_or'_exists",
"FStar.BigOps.pairwise_or'_cons"
] | [
"recursion"
] | false | false | true | false | false | let rec pairwise_or'_exists (#a: Type) (f: (a -> a -> Type)) (l: list a) =
| match l with
| [] -> pairwise_or'_nil f
| hd :: tl ->
pairwise_or'_cons f hd tl;
pairwise_or'_exists f tl;
big_or'_exists (f hd) tl | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.gctr128_bytes | val gctr128_bytes : Vale.Interop.Base.normal (s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32)
-> Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t s) | let gctr128_bytes //: normal ((s:Ghost.erased (Seq.seq nat32)) -> lowstar_gctr128_t s)
= as_normal_t #((s:Ghost.erased (Seq.seq nat32)) -> lowstar_gctr128_t s) (fun (s:Ghost.erased (Seq.seq nat32)) -> lowstar_gctr128 s) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 134,
"end_line": 258,
"start_col": 0,
"start_line": 257
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_gctr128 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr256_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr256_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr256_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr256_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr256_pre s) (gctr256_post s)) (gctr256_lemma' s)
noextract
let code_gctr256 = GC.va_code_Gctr_bytes_stdcall IA.win AES_256
[@__reduce__] noextract
let lowstar_gctr256_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr256
dom
[]
_
_
(W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_gctr256 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr256_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr256
dom
(W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win)) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | Vale.Interop.Base.normal (s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32)
-> Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t s) | Prims.Tot | [
"total"
] | [] | [
"Vale.Stdcalls.X64.GCTR.as_normal_t",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t",
"Vale.Stdcalls.X64.GCTR.lowstar_gctr128"
] | [] | false | false | false | false | false | let gctr128_bytes =
| as_normal_t #(s: Ghost.erased (Seq.seq nat32) -> lowstar_gctr128_t s)
(fun (s: Ghost.erased (Seq.seq nat32)) -> lowstar_gctr128 s) | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.as_normal_t | val as_normal_t (#a: Type) (x: a) : normal a | val as_normal_t (#a: Type) (x: a) : normal a | let as_normal_t (#a:Type) (x:a) : normal a = x | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | x: a -> Vale.Interop.Base.normal a | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.normal"
] | [] | false | false | false | true | false | let as_normal_t (#a: Type) (x: a) : normal a =
| x | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.qelem_lseq | val qelem_lseq : Type0 | let qelem_lseq = lseq uint64 4 | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 19,
"start_col": 0,
"start_line": 19
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64 | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.lseq",
"Lib.IntTypes.uint64"
] | [] | false | false | false | true | true | let qelem_lseq =
| lseq uint64 4 | false |
|
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.make_pow2_256_minus_order_k256 | val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q) | val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q) | let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 41,
"start_col": 0,
"start_line": 32
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Prims.Pure Hacl.Spec.K256.Scalar.qelem4 | Prims.Pure | [] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Hacl.Spec.K256.Scalar.qas_nat4",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.K256.PointOps.q",
"FStar.Pervasives.Native.tuple4",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Pervasives.Native.Mktuple4",
"Lib.IntTypes.uint64",
"Lib.IntTypes.u64",
"Hacl.Spec.K256.Scalar.qelem4"
] | [] | false | false | false | false | false | let make_pow2_256_minus_order_k256 () =
| [@@ inline_let ]let r = (u64 0x402da1732fc9bebf, u64 0x4551231950b75fc4, u64 0x1, u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.dom | val dom:dom: list td {List.length dom <= 20} | val dom:dom: list td {List.length dom <= 20} | let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 48,
"start_col": 0,
"start_line": 45
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Prims.Cons",
"Vale.Stdcalls.X64.GCTR.t128_no_mod",
"Vale.Stdcalls.X64.GCTR.tuint64",
"Vale.Stdcalls.X64.GCTR.t128_mod",
"Prims.Nil"
] | [] | false | false | false | false | false | let dom:dom: list td {List.length dom <= 20} =
| let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.mod_short_lseq | val mod_short_lseq: a:qelem_lseq -> qelem_lseq | val mod_short_lseq: a:qelem_lseq -> qelem_lseq | let mod_short_lseq a =
let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c, out = SB.bn_add a tmp in
let mask = u64 0 -. c in
map2 (BB.mask_select mask) out a | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 117,
"start_col": 0,
"start_line": 111
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end
inline_for_extraction noextract
let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3
inline_for_extraction noextract
let is_qelem_lt_pow2_128_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL
noextract | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Hacl.Spec.K256.Scalar.qelem_lseq -> Hacl.Spec.K256.Scalar.qelem_lseq | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.K256.Scalar.qelem_lseq",
"Lib.IntTypes.uint64",
"Hacl.Spec.Bignum.Base.carry",
"Lib.IntTypes.U64",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Lib.Sequence.map2",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.Base.mask_select",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.u64",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.bn_add",
"Lib.Sequence.lseq",
"Lib.Sequence.create4",
"Hacl.Spec.K256.Scalar.qelem4",
"Hacl.Spec.K256.Scalar.make_pow2_256_minus_order_k256"
] | [] | false | false | false | true | false | let mod_short_lseq a =
| let t0, t1, t2, t3 = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c, out = SB.bn_add a tmp in
let mask = u64 0 -. c in
map2 (BB.mask_select mask) out a | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.as_t | val as_t (#a: Type) (x: normal a) : a | val as_t (#a: Type) (x: normal a) : a | let as_t (#a:Type) (x:normal a) : a = x | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | x: Vale.Interop.Base.normal a -> a | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.normal"
] | [] | false | false | false | true | false | let as_t (#a: Type) (x: normal a) : a =
| x | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.mul_pow2_256_minus_q_lseq_add | val mul_pow2_256_minus_q_lseq_add:
len:size_nat -> resLen:size_nat{2 + len <= resLen /\ 4 <= resLen}
-> a:lseq uint64 len -> e:lseq uint64 4 -> BB.carry U64 & lseq uint64 resLen | val mul_pow2_256_minus_q_lseq_add:
len:size_nat -> resLen:size_nat{2 + len <= resLen /\ 4 <= resLen}
-> a:lseq uint64 len -> e:lseq uint64 4 -> BB.carry U64 & lseq uint64 resLen | let mul_pow2_256_minus_q_lseq_add len resLen a e =
let _, m = mul_pow2_256_minus_q_lseq len resLen a in // a * SECP256K1_N_C
SB.bn_add m e | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 143,
"start_col": 0,
"start_line": 141
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end
inline_for_extraction noextract
let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3
inline_for_extraction noextract
let is_qelem_lt_pow2_128_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL
noextract
val mod_short_lseq: a:qelem_lseq -> qelem_lseq
let mod_short_lseq a =
let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c, out = SB.bn_add a tmp in
let mask = u64 0 -. c in
map2 (BB.mask_select mask) out a
noextract
val mul_pow2_256_minus_q_lseq:
len:size_nat -> resLen:size_nat{2 + len <= resLen}
-> a:lseq uint64 len -> BB.carry U64 & lseq uint64 resLen
let mul_pow2_256_minus_q_lseq len resLen a =
let t0 = u64 0x402da1732fc9bebf in
let t1 = u64 0x4551231950b75fc4 in
let t01 = create2 t0 t1 in
let m0 = SB.bn_mul a t01 in // a * t01
let m1 = create resLen (u64 0) in
let m1 = update_sub m1 2 len a in // a * t2 * pow2 128
SB.bn_add m1 m0 // a * SECP256K1_N_C
noextract
val mul_pow2_256_minus_q_lseq_add:
len:size_nat -> resLen:size_nat{2 + len <= resLen /\ 4 <= resLen}
-> a:lseq uint64 len -> e:lseq uint64 4 -> BB.carry U64 & lseq uint64 resLen | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
len: Lib.IntTypes.size_nat ->
resLen: Lib.IntTypes.size_nat{2 + len <= resLen /\ 4 <= resLen} ->
a: Lib.Sequence.lseq Lib.IntTypes.uint64 len ->
e: Lib.Sequence.lseq Lib.IntTypes.uint64 4
-> Hacl.Spec.Bignum.Base.carry Lib.IntTypes.U64 * Lib.Sequence.lseq Lib.IntTypes.uint64 resLen | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.Sequence.lseq",
"Lib.IntTypes.uint64",
"Hacl.Spec.Bignum.Base.carry",
"Lib.IntTypes.U64",
"Hacl.Spec.Bignum.bn_add",
"FStar.Pervasives.Native.tuple2",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Hacl.Spec.K256.Scalar.mul_pow2_256_minus_q_lseq"
] | [] | false | false | false | false | false | let mul_pow2_256_minus_q_lseq_add len resLen a e =
| let _, m = mul_pow2_256_minus_q_lseq len resLen a in
SB.bn_add m e | false |
FStar.Algebra.CommMonoid.Fold.Nested.fst | FStar.Algebra.CommMonoid.Fold.Nested.double_fold_transpose_lemma | val double_fold_transpose_lemma (#c:_) (#eq: _)
(#m0: int) (#mk: not_less_than m0)
(#n0: int) (#nk: not_less_than n0)
(cm: CE.cm c eq)
(offset_gen: ifrom_ito m0 mk -> ifrom_ito n0 nk -> c)
: Lemma (double_fold cm offset_gen
`eq.eq`
double_fold cm (transpose_generator offset_gen)) | val double_fold_transpose_lemma (#c:_) (#eq: _)
(#m0: int) (#mk: not_less_than m0)
(#n0: int) (#nk: not_less_than n0)
(cm: CE.cm c eq)
(offset_gen: ifrom_ito m0 mk -> ifrom_ito n0 nk -> c)
: Lemma (double_fold cm offset_gen
`eq.eq`
double_fold cm (transpose_generator offset_gen)) | let double_fold_transpose_lemma #c #eq
(#m0: int) (#mk: not_less_than m0)
(#n0: int) (#nk: not_less_than n0)
(cm: CE.cm c eq)
(offset_gen: ifrom_ito m0 mk -> ifrom_ito n0 nk -> c)
: Lemma (double_fold cm offset_gen
`eq.eq`
double_fold cm (transpose_generator offset_gen)) =
let m = interval_size (ifrom_ito m0 mk) in
let n = interval_size (ifrom_ito n0 nk) in
let gen : matrix_generator c m n = fun i j -> offset_gen (m0+i) (n0+j) in
let trans #c #a #b (f: matrix_generator c a b) = transposed_matrix_gen f in
let trans_ofs #c (#a1 #a2 #b1 #b2:int) (f: ifrom_ito a1 a2 -> ifrom_ito b1 b2 -> c)
= transpose_generator f in
// Here, F* agrees that (n-1) == (nk-n0).
// But, replace (n-1) with (nk-n0) below, and the proof will fail :)
let subfold_lhs_base0 (i: under m) = CF.fold cm 0 (n-1) (gen i) in
let subfold_rhs_base0 (j: under n) = CF.fold cm 0 (m-1) (trans gen j) in
let subfold_lhs_precise (i: ifrom_ito m0 mk)
= CF.fold cm n0 nk (offset_gen i) in
let subfold_rhs_precise (j: ifrom_ito n0 nk)
= CF.fold cm m0 mk (trans_ofs offset_gen j) in
let lhs = CF.fold cm m0 mk subfold_lhs_precise in
let rhs = CF.fold cm n0 nk subfold_rhs_precise in
let aux_lhs (i: under m) : Lemma
(CF.fold cm n0 nk (offset_gen (m0+i)) == CF.fold cm 0 (n-1) (gen i)) =
CF.fold_offset_irrelevance_lemma cm n0 nk (offset_gen (m0+i)) 0 (n-1) (gen i) in
let aux_rhs (j: under n) : Lemma
(CF.fold cm m0 mk (trans_ofs offset_gen (n0+j)) ==
CF.fold cm 0 (m-1) (trans gen j))
= CF.fold_offset_irrelevance_lemma cm m0 mk (trans_ofs offset_gen (n0+j))
0 (m-1) (trans gen j) in
FStar.Classical.forall_intro aux_lhs;
FStar.Classical.forall_intro aux_rhs;
FStar.Classical.forall_intro eq.reflexivity;
matrix_fold_equals_func_double_fold cm gen;
matrix_fold_equals_func_double_fold cm (trans gen);
let matrix_mn = matrix_seq gen in
let matrix_nm = matrix_seq (trans gen) in
CF.fold_offset_elimination_lemma cm m0 mk subfold_lhs_precise subfold_lhs_base0;
CF.fold_offset_elimination_lemma cm n0 nk subfold_rhs_precise subfold_rhs_base0;
FStar.Classical.forall_intro_2 (FStar.Classical.move_requires_2 eq.symmetry);
FStar.Classical.forall_intro_3 (FStar.Classical.move_requires_3 eq.transitivity);
matrix_fold_equals_fold_of_transpose cm gen;
matrix_fold_equals_func_double_fold cm gen;
matrix_fold_equals_func_double_fold cm (transposed_matrix_gen gen);
assert_norm (double_fold cm (transpose_generator offset_gen) == rhs);
eq.transitivity (FStar.Seq.Permutation.foldm_snoc cm matrix_mn) lhs rhs | {
"file_name": "ulib/FStar.Algebra.CommMonoid.Fold.Nested.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 73,
"end_line": 92,
"start_col": 0,
"start_line": 45
} | (*
Copyright 2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
(*
Here we reason about nested folds of functions over arbitrary
integer intervals. We call such functions generators.
*)
module FStar.Algebra.CommMonoid.Fold.Nested
module CF = FStar.Algebra.CommMonoid.Fold
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.IntegerIntervals
open FStar.Matrix
(* Auxiliary utility that casts (matrix c m n) to seq of length (m*n) *)
let matrix_seq #c #m #r (generator: matrix_generator c m r) =
seq_of_matrix (Matrix.init generator)
(*
Most general form of nested fold swap theorem. Here we prove that we can
exchange the order of nested foldings over any suitable generator function.
We use the previously proved weaker version (for zero-based indices) in
order to prove this, because this way the two proofs together are way shorter.
I keep the argument types explicit in order to make the proof easier to read. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Permutation.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Matrix.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Fold.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Algebra.CommMonoid.Fold.Nested.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": "CF"
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid.Fold",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
cm: FStar.Algebra.CommMonoid.Equiv.cm c eq ->
offset_gen:
(_: FStar.IntegerIntervals.ifrom_ito m0 mk -> _: FStar.IntegerIntervals.ifrom_ito n0 nk -> c)
-> FStar.Pervasives.Lemma
(ensures
EQ?.eq eq
(FStar.Algebra.CommMonoid.Fold.Nested.double_fold cm offset_gen)
(FStar.Algebra.CommMonoid.Fold.Nested.double_fold cm
(FStar.Algebra.CommMonoid.Fold.Nested.transpose_generator offset_gen))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"Prims.int",
"FStar.IntegerIntervals.not_less_than",
"FStar.Algebra.CommMonoid.Equiv.cm",
"FStar.IntegerIntervals.ifrom_ito",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__transitivity",
"FStar.Seq.Permutation.foldm_snoc",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"FStar.Algebra.CommMonoid.Fold.Nested.double_fold",
"FStar.Algebra.CommMonoid.Fold.Nested.transpose_generator",
"FStar.Matrix.matrix_fold_equals_func_double_fold",
"FStar.Matrix.transposed_matrix_gen",
"FStar.Matrix.matrix_fold_equals_fold_of_transpose",
"FStar.Classical.forall_intro_3",
"Prims.l_imp",
"Prims.l_and",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Classical.move_requires_3",
"FStar.Classical.forall_intro_2",
"FStar.Classical.move_requires_2",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__symmetry",
"FStar.Algebra.CommMonoid.Fold.fold_offset_elimination_lemma",
"FStar.Seq.Base.seq",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Seq.Base.length",
"Prims.op_Multiply",
"Prims.l_Forall",
"FStar.IntegerIntervals.under",
"FStar.Seq.Base.index",
"FStar.Matrix.get_ij",
"FStar.Matrix.get_i",
"FStar.Matrix.get_j",
"FStar.Algebra.CommMonoid.Fold.Nested.matrix_seq",
"FStar.Classical.forall_intro",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__reflexivity",
"FStar.Algebra.CommMonoid.Fold.fold",
"Prims.op_Addition",
"Prims.op_Subtraction",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Algebra.CommMonoid.Fold.fold_offset_irrelevance_lemma",
"Prims.pos",
"FStar.Matrix.matrix_generator",
"Prims.nat",
"FStar.IntegerIntervals.interval_size"
] | [] | false | false | true | false | false | let double_fold_transpose_lemma
#c
#eq
(#m0: int)
(#mk: not_less_than m0)
(#n0: int)
(#nk: not_less_than n0)
(cm: CE.cm c eq)
(offset_gen: (ifrom_ito m0 mk -> ifrom_ito n0 nk -> c))
: Lemma ((double_fold cm offset_gen) `eq.eq` (double_fold cm (transpose_generator offset_gen))) =
| let m = interval_size (ifrom_ito m0 mk) in
let n = interval_size (ifrom_ito n0 nk) in
let gen:matrix_generator c m n = fun i j -> offset_gen (m0 + i) (n0 + j) in
let trans #c #a #b (f: matrix_generator c a b) = transposed_matrix_gen f in
let trans_ofs
#c
(#a1: int)
(#a2: int)
(#b1: int)
(#b2: int)
(f: (ifrom_ito a1 a2 -> ifrom_ito b1 b2 -> c))
=
transpose_generator f
in
let subfold_lhs_base0 (i: under m) = CF.fold cm 0 (n - 1) (gen i) in
let subfold_rhs_base0 (j: under n) = CF.fold cm 0 (m - 1) (trans gen j) in
let subfold_lhs_precise (i: ifrom_ito m0 mk) = CF.fold cm n0 nk (offset_gen i) in
let subfold_rhs_precise (j: ifrom_ito n0 nk) = CF.fold cm m0 mk (trans_ofs offset_gen j) in
let lhs = CF.fold cm m0 mk subfold_lhs_precise in
let rhs = CF.fold cm n0 nk subfold_rhs_precise in
let aux_lhs (i: under m)
: Lemma (CF.fold cm n0 nk (offset_gen (m0 + i)) == CF.fold cm 0 (n - 1) (gen i)) =
CF.fold_offset_irrelevance_lemma cm n0 nk (offset_gen (m0 + i)) 0 (n - 1) (gen i)
in
let aux_rhs (j: under n)
: Lemma (CF.fold cm m0 mk (trans_ofs offset_gen (n0 + j)) == CF.fold cm 0 (m - 1) (trans gen j))
=
CF.fold_offset_irrelevance_lemma cm m0 mk (trans_ofs offset_gen (n0 + j)) 0 (m - 1) (trans gen j)
in
FStar.Classical.forall_intro aux_lhs;
FStar.Classical.forall_intro aux_rhs;
FStar.Classical.forall_intro eq.reflexivity;
matrix_fold_equals_func_double_fold cm gen;
matrix_fold_equals_func_double_fold cm (trans gen);
let matrix_mn = matrix_seq gen in
let matrix_nm = matrix_seq (trans gen) in
CF.fold_offset_elimination_lemma cm m0 mk subfold_lhs_precise subfold_lhs_base0;
CF.fold_offset_elimination_lemma cm n0 nk subfold_rhs_precise subfold_rhs_base0;
FStar.Classical.forall_intro_2 (FStar.Classical.move_requires_2 eq.symmetry);
FStar.Classical.forall_intro_3 (FStar.Classical.move_requires_3 eq.transitivity);
matrix_fold_equals_fold_of_transpose cm gen;
matrix_fold_equals_func_double_fold cm gen;
matrix_fold_equals_func_double_fold cm (transposed_matrix_gen gen);
assert_norm (double_fold cm (transpose_generator offset_gen) == rhs);
eq.transitivity (FStar.Seq.Permutation.foldm_snoc cm matrix_mn) lhs rhs | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.lowstar_gctr256 | val lowstar_gctr256 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr256_t s | val lowstar_gctr256 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr256_t s | let lowstar_gctr256 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr256_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr256
dom
(W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win)) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 254,
"start_col": 0,
"start_line": 249
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_gctr128 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr256_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr256_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr256_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr256_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr256_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr256_pre s) (gctr256_post s)) (gctr256_lemma' s)
noextract
let code_gctr256 = GC.va_code_Gctr_bytes_stdcall IA.win AES_256
[@__reduce__] noextract
let lowstar_gctr256_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr256
dom
[]
_
_
(W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win))
(* And here's the gcm wrapper itself *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32)
-> Vale.Stdcalls.X64.GCTR.lowstar_gctr256_t s | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.Stdcalls.X64.GCTR.code_gctr256",
"Vale.Stdcalls.X64.GCTR.dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.Stdcalls.X64.GCTR.gctr256_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.GCTR.gctr256_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.GCTR.gctr256_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Vale.Stdcalls.X64.GCTR.lowstar_gctr256_t"
] | [] | false | false | false | false | false | let lowstar_gctr256 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr256_t s =
| assert_norm (List.length dom + List.length ([] <: list arg) <= 20);
IX64.wrap_weak_stdcall code_gctr256
dom
(W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win)) | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.mul_pow2_256_minus_q_lseq | val mul_pow2_256_minus_q_lseq:
len:size_nat -> resLen:size_nat{2 + len <= resLen}
-> a:lseq uint64 len -> BB.carry U64 & lseq uint64 resLen | val mul_pow2_256_minus_q_lseq:
len:size_nat -> resLen:size_nat{2 + len <= resLen}
-> a:lseq uint64 len -> BB.carry U64 & lseq uint64 resLen | let mul_pow2_256_minus_q_lseq len resLen a =
let t0 = u64 0x402da1732fc9bebf in
let t1 = u64 0x4551231950b75fc4 in
let t01 = create2 t0 t1 in
let m0 = SB.bn_mul a t01 in // a * t01
let m1 = create resLen (u64 0) in
let m1 = update_sub m1 2 len a in // a * t2 * pow2 128
SB.bn_add m1 m0 | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 17,
"end_line": 133,
"start_col": 0,
"start_line": 125
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end
inline_for_extraction noextract
let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3
inline_for_extraction noextract
let is_qelem_lt_pow2_128_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL
noextract
val mod_short_lseq: a:qelem_lseq -> qelem_lseq
let mod_short_lseq a =
let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c, out = SB.bn_add a tmp in
let mask = u64 0 -. c in
map2 (BB.mask_select mask) out a
noextract
val mul_pow2_256_minus_q_lseq:
len:size_nat -> resLen:size_nat{2 + len <= resLen}
-> a:lseq uint64 len -> BB.carry U64 & lseq uint64 resLen | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
len: Lib.IntTypes.size_nat ->
resLen: Lib.IntTypes.size_nat{2 + len <= resLen} ->
a: Lib.Sequence.lseq Lib.IntTypes.uint64 len
-> Hacl.Spec.Bignum.Base.carry Lib.IntTypes.U64 * Lib.Sequence.lseq Lib.IntTypes.uint64 resLen | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.Sequence.lseq",
"Lib.IntTypes.uint64",
"Hacl.Spec.Bignum.bn_add",
"Lib.IntTypes.U64",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Prims.l_and",
"Prims.eq2",
"Lib.Sequence.sub",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_or",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index",
"Lib.Sequence.update_sub",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.create",
"Lib.IntTypes.mk_int",
"Prims.l_imp",
"Lib.Sequence.create",
"Lib.IntTypes.u64",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.bn_mul",
"Hacl.Spec.Bignum.Definitions.limb",
"Lib.Sequence.create2",
"Prims.int",
"Lib.IntTypes.range",
"Lib.IntTypes.v",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.Base.carry"
] | [] | false | false | false | false | false | let mul_pow2_256_minus_q_lseq len resLen a =
| let t0 = u64 0x402da1732fc9bebf in
let t1 = u64 0x4551231950b75fc4 in
let t01 = create2 t0 t1 in
let m0 = SB.bn_mul a t01 in
let m1 = create resLen (u64 0) in
let m1 = update_sub m1 2 len a in
SB.bn_add m1 m0 | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.seq_prefix | val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0 | val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0 | let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1)) | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 41,
"end_line": 21,
"start_col": 0,
"start_line": 20
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} -> | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
s1: FStar.Seq.Base.seq a ->
s2: FStar.Seq.Base.seq a {FStar.Seq.Base.length s1 <= FStar.Seq.Base.length s2}
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Seq.Base.seq",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.slice"
] | [] | false | false | false | false | true | let seq_prefix #a s1 s2 =
| S.equal s1 (S.slice s2 0 (S.length s1)) | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.empty_hashes | val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len}) | val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len}) | let empty_hashes #hsz len = S.create len S.empty | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 48,
"end_line": 40,
"start_col": 0,
"start_line": 40
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0
let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1))
val seq_head_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.head (S.cons x s) == x)
[SMTPat (S.cons x s)]
let seq_head_cons #a x s = ()
val seq_tail_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.equal (S.tail (S.cons x s)) s)
[SMTPat (S.cons x s)]
let seq_tail_cons #a x s = ()
/// Invariants and simulation relation of high-level Merkle tree design
// Invariants of internal hashes | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | len: Prims.nat -> Prims.GTot (hs: MerkleTree.New.High.hashess{FStar.Seq.Base.length hs = len}) | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.pos",
"Prims.nat",
"FStar.Seq.Base.create",
"MerkleTree.New.High.hashes",
"FStar.Seq.Base.empty",
"MerkleTree.New.High.hash",
"MerkleTree.New.High.hashess",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Seq.Base.length"
] | [] | false | false | false | false | false | let empty_hashes #hsz len =
| S.create len S.empty | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.gctr128_pre | val gctr128_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom | val gctr128_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom | let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 66,
"start_col": 0,
"start_line": 52
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Words_s.nat32)
-> Vale.AsLowStar.ValeSig.vale_pre Vale.Stdcalls.X64.GCTR.dom | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.GCTR.b128",
"Vale.Stdcalls.X64.GCTR.uint64",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.GCTR.va_req_Gctr_bytes_stdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.UInt64.v",
"FStar.Ghost.reveal",
"Prims.prop"
] | [] | false | false | false | true | false | let gctr128_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
| fun
(s: Ghost.erased (Seq.seq nat32))
(c: V.va_code)
(in_b: b128)
(num_bytes: uint64)
(out_b: b128)
(inout_b: b128)
(keys_b: b128)
(ctr_b: b128)
(num_blocks: uint64)
(va_s0: V.va_state)
->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128 (as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b) (as_vale_buffer ctr_b)
(UInt64.v num_blocks) (Ghost.reveal s) | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t | val lowstar_gctr128_t : s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32) -> Type0 | let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win)) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 142,
"start_col": 0,
"start_line": 134
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32) -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.Stdcalls.X64.GCTR.code_gctr128",
"Vale.Stdcalls.X64.GCTR.dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Stdcalls.X64.GCTR.gctr128_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.GCTR.gctr128_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.GCTR.gctr128_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | false | false | false | true | true | let lowstar_gctr128_t (s: Ghost.erased (Seq.seq nat32)) =
| assert_norm (List.length dom + List.length ([] <: list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win)) | false |
|
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.lowstar_gctr128 | val lowstar_gctr128 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s | val lowstar_gctr128 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s | let lowstar_gctr128 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win)) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 151,
"start_col": 0,
"start_line": 146
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* And here's the gcm wrapper itself *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32)
-> Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t s | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.Stdcalls.X64.GCTR.code_gctr128",
"Vale.Stdcalls.X64.GCTR.dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.Stdcalls.X64.GCTR.gctr128_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.GCTR.gctr128_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.GCTR.gctr128_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t"
] | [] | false | false | false | false | false | let lowstar_gctr128 (s: Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
| assert_norm (List.length dom + List.length ([] <: list arg) <= 20);
IX64.wrap_weak_stdcall code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win)) | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv | val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} ->
GTot Type0 (decreases (32 - lv)) | val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} ->
GTot Type0 (decreases (32 - lv)) | let rec mt_hashes_lth_inv #hsz lv j fhs =
if lv = 32 then true
else (S.length (S.index fhs lv) == j /\
mt_hashes_lth_inv (lv + 1) (j / 2) fhs) | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 46,
"end_line": 65,
"start_col": 0,
"start_line": 62
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0
let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1))
val seq_head_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.head (S.cons x s) == x)
[SMTPat (S.cons x s)]
let seq_head_cons #a x s = ()
val seq_tail_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.equal (S.tail (S.cons x s)) s)
[SMTPat (S.cons x s)]
let seq_tail_cons #a x s = ()
/// Invariants and simulation relation of high-level Merkle tree design
// Invariants of internal hashes
val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len})
let empty_hashes #hsz len = S.create len S.empty
val empty_hashes_head:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.head (empty_hashes #hsz len) == S.empty)
let empty_hashes_head #_ _ = ()
val empty_hashes_tail:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.equal (S.tail (empty_hashes len))
(empty_hashes #hsz (len - 1)))
let empty_hashes_tail #_ _ = ()
#push-options "--max_fuel 1"
val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} -> | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
lv: Prims.nat{lv <= 32} ->
j: Prims.nat{j < Prims.pow2 (32 - lv)} ->
fhs: MerkleTree.New.High.hashess{FStar.Seq.Base.length fhs = 32}
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial",
""
] | [] | [
"Prims.pos",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.op_Subtraction",
"MerkleTree.New.High.hashess",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"MerkleTree.New.High.hashes",
"Prims.bool",
"Prims.l_and",
"Prims.eq2",
"MerkleTree.New.High.hash",
"FStar.Seq.Base.index",
"MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv",
"Prims.op_Addition",
"Prims.op_Division"
] | [
"recursion"
] | false | false | false | false | true | let rec mt_hashes_lth_inv #hsz lv j fhs =
| if lv = 32 then true else (S.length (S.index fhs lv) == j /\ mt_hashes_lth_inv (lv + 1) (j / 2) fhs) | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.gctr256_pre | val gctr256_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom | val gctr256_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom | let gctr256_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_256
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 169,
"start_col": 0,
"start_line": 155
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let gctr128_lemma'
(s:Ghost.erased (Seq.seq nat32))
(code:V.va_code)
(_win:bool)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer in_b) /\
ME.buffer_writeable (as_vale_buffer keys_b) /\
ME.buffer_writeable (as_vale_buffer ctr_b) /\
ME.buffer_writeable (as_vale_buffer inout_b) /\
ME.buffer_writeable (as_vale_buffer out_b)
)) =
let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;
(va_s1, f)
noextract
let gctr128_lemma (s:Ghost.erased (Seq.seq nat32)) = as_t #(VSig.vale_sig_stdcall (gctr128_pre s) (gctr128_post s)) (gctr128_lemma' s)
noextract
let code_gctr128 = GC.va_code_Gctr_bytes_stdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_gctr128
dom
[]
_
_
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_gctr128 (s:Ghost.erased (Seq.seq nat32)) : lowstar_gctr128_t s =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_gctr128
dom
(W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))
(* Need to rearrange the order of arguments *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Words_s.nat32)
-> Vale.AsLowStar.ValeSig.vale_pre Vale.Stdcalls.X64.GCTR.dom | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.GCTR.b128",
"Vale.Stdcalls.X64.GCTR.uint64",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.GCTR.va_req_Gctr_bytes_stdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.UInt64.v",
"FStar.Ghost.reveal",
"Prims.prop"
] | [] | false | false | false | true | false | let gctr256_pre: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
| fun
(s: Ghost.erased (Seq.seq nat32))
(c: V.va_code)
(in_b: b128)
(num_bytes: uint64)
(out_b: b128)
(inout_b: b128)
(keys_b: b128)
(ctr_b: b128)
(num_blocks: uint64)
(va_s0: V.va_state)
->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_256 (as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b) (as_vale_buffer ctr_b)
(UInt64.v num_blocks) (Ghost.reveal s) | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv_empty | val mt_hashes_lth_inv_empty:
#hsz:pos ->
lv:nat{lv <= 32} ->
Lemma (requires True)
(ensures mt_hashes_lth_inv lv 0 (empty_hashes #hsz 32))
(decreases (32 - lv)) | val mt_hashes_lth_inv_empty:
#hsz:pos ->
lv:nat{lv <= 32} ->
Lemma (requires True)
(ensures mt_hashes_lth_inv lv 0 (empty_hashes #hsz 32))
(decreases (32 - lv)) | let rec mt_hashes_lth_inv_empty #hsz lv =
if lv = 32 then ()
else mt_hashes_lth_inv_empty #hsz (lv + 1) | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 44,
"end_line": 75,
"start_col": 0,
"start_line": 73
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0
let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1))
val seq_head_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.head (S.cons x s) == x)
[SMTPat (S.cons x s)]
let seq_head_cons #a x s = ()
val seq_tail_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.equal (S.tail (S.cons x s)) s)
[SMTPat (S.cons x s)]
let seq_tail_cons #a x s = ()
/// Invariants and simulation relation of high-level Merkle tree design
// Invariants of internal hashes
val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len})
let empty_hashes #hsz len = S.create len S.empty
val empty_hashes_head:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.head (empty_hashes #hsz len) == S.empty)
let empty_hashes_head #_ _ = ()
val empty_hashes_tail:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.equal (S.tail (empty_hashes len))
(empty_hashes #hsz (len - 1)))
let empty_hashes_tail #_ _ = ()
#push-options "--max_fuel 1"
val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} ->
GTot Type0 (decreases (32 - lv))
let rec mt_hashes_lth_inv #hsz lv j fhs =
if lv = 32 then true
else (S.length (S.index fhs lv) == j /\
mt_hashes_lth_inv (lv + 1) (j / 2) fhs)
val mt_hashes_lth_inv_empty:
#hsz:pos ->
lv:nat{lv <= 32} ->
Lemma (requires True)
(ensures mt_hashes_lth_inv lv 0 (empty_hashes #hsz 32)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | lv: Prims.nat{lv <= 32}
-> FStar.Pervasives.Lemma
(ensures
MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv lv
0
(MerkleTree.New.High.Correct.Base.empty_hashes 32)) (decreases 32 - lv) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Prims.pos",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv_empty",
"Prims.op_Addition",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec mt_hashes_lth_inv_empty #hsz lv =
| if lv = 32 then () else mt_hashes_lth_inv_empty #hsz (lv + 1) | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.merge_hs_empty | val merge_hs_empty:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
len:nat ->
Lemma (S.equal (merge_hs #_ #f (empty_hashes #hsz len) (empty_hashes #hsz len))
(empty_hashes #hsz len)) | val merge_hs_empty:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
len:nat ->
Lemma (S.equal (merge_hs #_ #f (empty_hashes #hsz len) (empty_hashes #hsz len))
(empty_hashes #hsz len)) | let rec merge_hs_empty #hsz #f len =
if len = 0 then ()
else (empty_hashes_head #hsz len;
empty_hashes_tail #hsz len;
assert (S.equal (S.append #(hash #hsz) S.empty S.empty)
(S.empty #(hash #hsz)));
assert (S.equal (merge_hs #_ #f (empty_hashes len) (empty_hashes len))
(S.cons S.empty
(merge_hs #_ #f (empty_hashes (len - 1))
(empty_hashes (len - 1)))));
merge_hs_empty #_ #f (len - 1)) | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 38,
"end_line": 173,
"start_col": 0,
"start_line": 163
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0
let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1))
val seq_head_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.head (S.cons x s) == x)
[SMTPat (S.cons x s)]
let seq_head_cons #a x s = ()
val seq_tail_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.equal (S.tail (S.cons x s)) s)
[SMTPat (S.cons x s)]
let seq_tail_cons #a x s = ()
/// Invariants and simulation relation of high-level Merkle tree design
// Invariants of internal hashes
val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len})
let empty_hashes #hsz len = S.create len S.empty
val empty_hashes_head:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.head (empty_hashes #hsz len) == S.empty)
let empty_hashes_head #_ _ = ()
val empty_hashes_tail:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.equal (S.tail (empty_hashes len))
(empty_hashes #hsz (len - 1)))
let empty_hashes_tail #_ _ = ()
#push-options "--max_fuel 1"
val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} ->
GTot Type0 (decreases (32 - lv))
let rec mt_hashes_lth_inv #hsz lv j fhs =
if lv = 32 then true
else (S.length (S.index fhs lv) == j /\
mt_hashes_lth_inv (lv + 1) (j / 2) fhs)
val mt_hashes_lth_inv_empty:
#hsz:pos ->
lv:nat{lv <= 32} ->
Lemma (requires True)
(ensures mt_hashes_lth_inv lv 0 (empty_hashes #hsz 32))
(decreases (32 - lv))
let rec mt_hashes_lth_inv_empty #hsz lv =
if lv = 32 then ()
else mt_hashes_lth_inv_empty #hsz (lv + 1)
val mt_hashes_next_rel:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
j:nat ->
hs:hashes #hsz {S.length hs = j} ->
nhs:hashes #hsz {S.length nhs = j / 2} ->
GTot Type0
let mt_hashes_next_rel #hsz #f j hs nhs =
forall (i:nat{i < j / 2}).
S.index nhs i ==
f (S.index hs (op_Multiply 2 i))
(S.index hs (op_Multiply 2 i + 1))
#pop-options
#push-options "--max_fuel 2"
val mt_hashes_inv:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
lv:nat{lv < 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32 /\ mt_hashes_lth_inv lv j fhs} ->
GTot Type0 (decreases (32 - lv))
let rec mt_hashes_inv #hsz #f lv j fhs =
if lv = 31 then true
else (mt_hashes_next_rel #_ #f j (S.index fhs lv) (S.index fhs (lv + 1)) /\
mt_hashes_inv #_ #f (lv + 1) (j / 2) fhs)
val mt_hashes_inv_empty:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
lv:nat{lv < 32} ->
Lemma (requires True)
(ensures (mt_hashes_lth_inv_empty #hsz lv;
mt_hashes_inv #hsz #f lv 0 (empty_hashes #hsz 32)))
(decreases (32 - lv))
let rec mt_hashes_inv_empty #hsz #f lv =
if lv = 31 then ()
else (mt_hashes_lth_inv_empty #hsz (lv + 1);
mt_hashes_inv_empty #_ #f (lv + 1))
val mt_hashes_lth_inv_equiv:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
lv:nat{lv < 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs1:hashess{S.length fhs1 = 32} ->
fhs2:hashess{S.length fhs2 = 32} ->
Lemma (requires mt_hashes_lth_inv lv j fhs1 /\
S.equal (S.slice fhs1 lv 32) (S.slice fhs2 lv 32))
(ensures mt_hashes_lth_inv #hsz lv j fhs2)
(decreases (32 - lv))
let rec mt_hashes_lth_inv_equiv #hsz #f lv j fhs1 fhs2 =
if lv = 31 then ()
else (assert (S.index fhs1 lv == S.index fhs2 lv);
mt_hashes_lth_inv_equiv #_ #f (lv + 1) (j / 2) fhs1 fhs2)
#pop-options
#push-options "--max_fuel 1"
val mt_hashes_inv_equiv:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
lv:nat{lv < 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs1:hashess #hsz {S.length fhs1 = 32 /\ mt_hashes_lth_inv lv j fhs1} ->
fhs2:hashess #hsz {S.length fhs2 = 32 /\ mt_hashes_lth_inv lv j fhs2} ->
Lemma (requires mt_hashes_inv #_ #f lv j fhs1 /\
S.equal (S.slice fhs1 lv 32) (S.slice fhs2 lv 32))
(ensures mt_hashes_inv #_ #f lv j fhs2)
(decreases (32 - lv))
let rec mt_hashes_inv_equiv #hsz #f lv j fhs1 fhs2 =
if lv = 31 then ()
else (assert (S.index fhs1 lv == S.index fhs2 lv);
assert (S.index fhs1 (lv + 1) == S.index fhs2 (lv + 1));
mt_hashes_inv_equiv #_ #f (lv + 1) (j / 2) fhs1 fhs2)
val merge_hs:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
hs1:hashess #hsz ->
hs2:hashess #hsz {S.length hs1 = S.length hs2} ->
GTot (mhs:hashess #hsz {S.length mhs = S.length hs1})
(decreases (S.length hs1))
let rec merge_hs #hsz #f hs1 hs2 =
if S.length hs1 = 0 then S.empty
else (S.cons (S.append (S.head hs1) (S.head hs2))
(merge_hs #_ #f (S.tail hs1) (S.tail hs2)))
val merge_hs_empty:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
len:nat ->
Lemma (S.equal (merge_hs #_ #f (empty_hashes #hsz len) (empty_hashes #hsz len)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | len: Prims.nat
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.equal (MerkleTree.New.High.Correct.Base.merge_hs (MerkleTree.New.High.Correct.Base.empty_hashes
len)
(MerkleTree.New.High.Correct.Base.empty_hashes len))
(MerkleTree.New.High.Correct.Base.empty_hashes len)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.pos",
"MerkleTree.Spec.hash_fun_t",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"MerkleTree.New.High.Correct.Base.merge_hs_empty",
"Prims.op_Subtraction",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"MerkleTree.New.High.hashes",
"MerkleTree.New.High.Correct.Base.merge_hs",
"MerkleTree.New.High.Correct.Base.empty_hashes",
"FStar.Seq.Base.cons",
"FStar.Seq.Base.empty",
"MerkleTree.New.High.hash",
"FStar.Seq.Base.append",
"MerkleTree.New.High.Correct.Base.empty_hashes_tail",
"MerkleTree.New.High.Correct.Base.empty_hashes_head"
] | [
"recursion"
] | false | false | true | false | false | let rec merge_hs_empty #hsz #f len =
| if len = 0
then ()
else
(empty_hashes_head #hsz len;
empty_hashes_tail #hsz len;
assert (S.equal (S.append #(hash #hsz) S.empty S.empty) (S.empty #(hash #hsz)));
assert (S.equal (merge_hs #_ #f (empty_hashes len) (empty_hashes len))
(S.cons S.empty (merge_hs #_ #f (empty_hashes (len - 1)) (empty_hashes (len - 1)))));
merge_hs_empty #_ #f (len - 1)) | false |
Vale.Stdcalls.X64.GCTR.fst | Vale.Stdcalls.X64.GCTR.gctr128_post | val gctr128_post: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom | val gctr128_post: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom | let gctr128_post : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) va_s1 f | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCTR.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 77,
"end_line": 86,
"start_col": 0,
"start_line": 70
} | module Vale.Stdcalls.X64.GCTR
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module GC = Vale.AES.X64.GCTR
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; t128_mod; t128_mod; t128_no_mod; t128_no_mod; tuint64] in
assert_norm (List.length y = 7);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let gctr128_pre : (Ghost.erased (Seq.seq nat32)) -> VSig.vale_pre dom =
fun (s:Ghost.erased (Seq.seq nat32))
(c:V.va_code)
(in_b:b128)
(num_bytes:uint64)
(out_b:b128)
(inout_b:b128)
(keys_b:b128)
(ctr_b:b128)
(num_blocks:uint64)
(va_s0:V.va_state) ->
GC.va_req_Gctr_bytes_stdcall c va_s0 IA.win AES_128
(as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)
(as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s)
(* Need to rearrange the order of arguments *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCTR.fst"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCTR",
"short_module": "GC"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.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": 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 | s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Words_s.nat32)
-> Vale.AsLowStar.ValeSig.vale_post Vale.Stdcalls.X64.GCTR.dom | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.GCTR.b128",
"Vale.Stdcalls.X64.GCTR.uint64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.AES.X64.GCTR.va_ens_Gctr_bytes_stdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.UInt64.v",
"FStar.Ghost.reveal",
"Prims.prop"
] | [] | false | false | false | true | false | let gctr128_post: (Ghost.erased (Seq.seq nat32)) -> VSig.vale_post dom =
| fun
(s: Ghost.erased (Seq.seq nat32))
(c: V.va_code)
(in_b: b128)
(num_bytes: uint64)
(out_b: b128)
(inout_b: b128)
(keys_b: b128)
(ctr_b: b128)
(num_blocks: uint64)
(va_s0: V.va_state)
(va_s1: V.va_state)
(f: V.va_fuel)
->
GC.va_ens_Gctr_bytes_stdcall c va_s0 IA.win AES_128 (as_vale_buffer in_b) (UInt64.v num_bytes)
(as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b) (as_vale_buffer ctr_b)
(UInt64.v num_blocks) (Ghost.reveal s) va_s1 f | false |
Hacl.Spec.K256.Scalar.fst | Hacl.Spec.K256.Scalar.mod_lseq | val mod_lseq: a:lseq uint64 8 -> qelem_lseq | val mod_lseq: a:lseq uint64 8 -> qelem_lseq | let mod_lseq a =
let c0, r = mod_lseq_before_final a in
let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c1, out = SB.bn_add r tmp in
let mask = u64 0 -. (c0 +. c1) in
map2 (BB.mask_select mask) out r | {
"file_name": "code/k256/Hacl.Spec.K256.Scalar.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 178,
"start_col": 0,
"start_line": 170
} | module Hacl.Spec.K256.Scalar
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module BSeq = Lib.ByteSequence
module SB = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelem4 = uint64 & uint64 & uint64 & uint64
inline_for_extraction noextract
let qelem_lseq = lseq uint64 4
noextract
let qas_nat4 (f:qelem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
val make_pow2_256_minus_order_k256: unit -> Pure qelem4
(requires True)
(ensures fun r -> qas_nat4 r = pow2 256 - S.q)
let make_pow2_256_minus_order_k256 () =
[@inline_let]
let r =
(u64 0x402da1732fc9bebf,
u64 0x4551231950b75fc4,
u64 0x1,
u64 0x0) in
assert_norm (qas_nat4 r = pow2 256 - S.q);
r
inline_for_extraction noextract
let is_qelem_zero_vartime4 ((f0,f1,f2,f3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 f0 =. 0uL &&
u64_to_UInt64 f1 =. 0uL &&
u64_to_UInt64 f2 =. 0uL &&
u64_to_UInt64 f3 =. 0uL
inline_for_extraction noextract
let is_qelem_lt_q_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 <. 0xfffffffffffffffeuL then true
else begin
if u64_to_UInt64 a2 >. 0xfffffffffffffffeuL then false
else begin
if u64_to_UInt64 a1 <. 0xbaaedce6af48a03buL then true
else begin
if u64_to_UInt64 a1 >. 0xbaaedce6af48a03buL then false
else u64_to_UInt64 a0 <. 0xbfd25e8cd0364141uL
end
end
end
end
inline_for_extraction noextract
let is_qelem_le_q_halved_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
if u64_to_UInt64 a3 <. 0x7fffffffffffffffuL then true
else begin
if u64_to_UInt64 a3 >. 0x7fffffffffffffffuL then false
else begin
if u64_to_UInt64 a2 <. 0xffffffffffffffffuL then true
else begin
if u64_to_UInt64 a2 >. 0xffffffffffffffffuL then false
else begin
if u64_to_UInt64 a1 <. 0x5d576e7357a4501duL then true
else begin
if u64_to_UInt64 a1 >. 0x5d576e7357a4501duL then false
else u64_to_UInt64 a0 <=. 0xdfe92f46681b20a0uL
end
end
end
end
end
inline_for_extraction noextract
let is_qelem_eq_vartime4 ((a0,a1,a2,a3): qelem4) ((b0,b1,b2,b3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a0 =. u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =. u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =. u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =. u64_to_UInt64 b3
inline_for_extraction noextract
let is_qelem_lt_pow2_128_vartime4 ((a0,a1,a2,a3): qelem4) : bool =
let open Lib.RawIntTypes in
u64_to_UInt64 a2 =. 0uL && u64_to_UInt64 a3 =. 0uL
noextract
val mod_short_lseq: a:qelem_lseq -> qelem_lseq
let mod_short_lseq a =
let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c, out = SB.bn_add a tmp in
let mask = u64 0 -. c in
map2 (BB.mask_select mask) out a
noextract
val mul_pow2_256_minus_q_lseq:
len:size_nat -> resLen:size_nat{2 + len <= resLen}
-> a:lseq uint64 len -> BB.carry U64 & lseq uint64 resLen
let mul_pow2_256_minus_q_lseq len resLen a =
let t0 = u64 0x402da1732fc9bebf in
let t1 = u64 0x4551231950b75fc4 in
let t01 = create2 t0 t1 in
let m0 = SB.bn_mul a t01 in // a * t01
let m1 = create resLen (u64 0) in
let m1 = update_sub m1 2 len a in // a * t2 * pow2 128
SB.bn_add m1 m0 // a * SECP256K1_N_C
noextract
val mul_pow2_256_minus_q_lseq_add:
len:size_nat -> resLen:size_nat{2 + len <= resLen /\ 4 <= resLen}
-> a:lseq uint64 len -> e:lseq uint64 4 -> BB.carry U64 & lseq uint64 resLen
let mul_pow2_256_minus_q_lseq_add len resLen a e =
let _, m = mul_pow2_256_minus_q_lseq len resLen a in // a * SECP256K1_N_C
SB.bn_add m e // e + a * SECP256K1_N_C
noextract
val mod_lseq_before_final: a:lseq uint64 8 -> BB.carry U64 & qelem_lseq
let mod_lseq_before_final a =
// Reduce 512 bits into 385.
// m[0..6] = a[0..3] + a[4..7] * SECP256K1_N_C.
// Reduce 385 bits into 258.
// p[0..4] = m[0..3] + m[4..6] * SECP256K1_N_C.
// Reduce 258 bits into 256.
// c, r[0..3] = p[0..3] + p[4] * SECP256K1_N_C.
// Final reduction of r.
// secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r));
// 385 // 64 = 7
let _, m = mul_pow2_256_minus_q_lseq_add 4 7 (sub a 4 4) (sub a 0 4) in // a[0..3] + a[4..7] * SECP256K1_N_C
// 258 // 64 = 5
let _, p = mul_pow2_256_minus_q_lseq_add 3 5 (sub m 4 3) (sub m 0 4) in // m[0..3] + m[4..6] * SECP256K1_N_C
mul_pow2_256_minus_q_lseq_add 1 4 (sub p 4 1) (sub p 0 4) // p[0..3] + p[4] * SECP256K1_N_C
noextract | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Scalar.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Lib.Sequence.lseq Lib.IntTypes.uint64 8 -> Hacl.Spec.K256.Scalar.qelem_lseq | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.lseq",
"Lib.IntTypes.uint64",
"Hacl.Spec.Bignum.Base.carry",
"Lib.IntTypes.U64",
"Hacl.Spec.K256.Scalar.qelem_lseq",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Lib.Sequence.map2",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.Base.mask_select",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.u64",
"Lib.IntTypes.op_Plus_Dot",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.bn_add",
"Lib.Sequence.create4",
"Hacl.Spec.K256.Scalar.qelem4",
"Hacl.Spec.K256.Scalar.make_pow2_256_minus_order_k256",
"Hacl.Spec.K256.Scalar.mod_lseq_before_final"
] | [] | false | false | false | false | false | let mod_lseq a =
| let c0, r = mod_lseq_before_final a in
let t0, t1, t2, t3 = make_pow2_256_minus_order_k256 () in
let tmp = create4 t0 t1 t2 t3 in
let c1, out = SB.bn_add r tmp in
let mask = u64 0 -. (c0 +. c1) in
map2 (BB.mask_select mask) out r | false |
MerkleTree.New.High.Correct.Base.fst | MerkleTree.New.High.Correct.Base.mt_hashes_next_rel | val mt_hashes_next_rel:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
j:nat ->
hs:hashes #hsz {S.length hs = j} ->
nhs:hashes #hsz {S.length nhs = j / 2} ->
GTot Type0 | val mt_hashes_next_rel:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
j:nat ->
hs:hashes #hsz {S.length hs = j} ->
nhs:hashes #hsz {S.length nhs = j / 2} ->
GTot Type0 | let mt_hashes_next_rel #hsz #f j hs nhs =
forall (i:nat{i < j / 2}).
S.index nhs i ==
f (S.index hs (op_Multiply 2 i))
(S.index hs (op_Multiply 2 i + 1)) | {
"file_name": "src/MerkleTree.New.High.Correct.Base.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 45,
"end_line": 87,
"start_col": 0,
"start_line": 83
} | module MerkleTree.New.High.Correct.Base
open FStar.Classical
open FStar.Ghost
open FStar.Seq
module S = FStar.Seq
module MTS = MerkleTree.Spec
open MerkleTree.New.High
#set-options "--z3rlimit 40 --max_fuel 0 --max_ifuel 0"
/// Sequence helpers
val seq_prefix:
#a:Type -> s1:S.seq a ->
s2:S.seq a{S.length s1 <= S.length s2} ->
GTot Type0
let seq_prefix #a s1 s2 =
S.equal s1 (S.slice s2 0 (S.length s1))
val seq_head_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.head (S.cons x s) == x)
[SMTPat (S.cons x s)]
let seq_head_cons #a x s = ()
val seq_tail_cons:
#a:Type -> x:a -> s:S.seq a ->
Lemma (S.equal (S.tail (S.cons x s)) s)
[SMTPat (S.cons x s)]
let seq_tail_cons #a x s = ()
/// Invariants and simulation relation of high-level Merkle tree design
// Invariants of internal hashes
val empty_hashes: (#hsz:pos) -> (len:nat) -> GTot (hs:hashess #hsz {S.length hs = len})
let empty_hashes #hsz len = S.create len S.empty
val empty_hashes_head:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.head (empty_hashes #hsz len) == S.empty)
let empty_hashes_head #_ _ = ()
val empty_hashes_tail:
#hsz:pos ->
len:nat{len > 0} ->
Lemma (S.equal (S.tail (empty_hashes len))
(empty_hashes #hsz (len - 1)))
let empty_hashes_tail #_ _ = ()
#push-options "--max_fuel 1"
val mt_hashes_lth_inv:
#hsz:pos ->
lv:nat{lv <= 32} ->
j:nat{j < pow2 (32 - lv)} ->
fhs:hashess #hsz {S.length fhs = 32} ->
GTot Type0 (decreases (32 - lv))
let rec mt_hashes_lth_inv #hsz lv j fhs =
if lv = 32 then true
else (S.length (S.index fhs lv) == j /\
mt_hashes_lth_inv (lv + 1) (j / 2) fhs)
val mt_hashes_lth_inv_empty:
#hsz:pos ->
lv:nat{lv <= 32} ->
Lemma (requires True)
(ensures mt_hashes_lth_inv lv 0 (empty_hashes #hsz 32))
(decreases (32 - lv))
let rec mt_hashes_lth_inv_empty #hsz lv =
if lv = 32 then ()
else mt_hashes_lth_inv_empty #hsz (lv + 1)
val mt_hashes_next_rel:
#hsz:pos -> #f:MTS.hash_fun_t #hsz ->
j:nat ->
hs:hashes #hsz {S.length hs = j} ->
nhs:hashes #hsz {S.length nhs = j / 2} -> | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.New.High.Correct.Base.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.New.High",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.New.High.Correct",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
j: Prims.nat ->
hs: MerkleTree.New.High.hashes{FStar.Seq.Base.length hs = j} ->
nhs: MerkleTree.New.High.hashes{FStar.Seq.Base.length nhs = j / 2}
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.pos",
"MerkleTree.Spec.hash_fun_t",
"Prims.nat",
"MerkleTree.New.High.hashes",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Seq.Base.length",
"MerkleTree.New.High.hash",
"Prims.int",
"Prims.op_Division",
"Prims.l_Forall",
"Prims.op_LessThan",
"Prims.eq2",
"Spec.Hash.Definitions.bytes",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_GreaterThan",
"Lib.IntTypes.uint8",
"FStar.Seq.Base.index",
"Prims.op_Multiply",
"Prims.op_Addition"
] | [] | false | false | false | false | true | let mt_hashes_next_rel #hsz #f j hs nhs =
| forall (i: nat{i < j / 2}).
S.index nhs i == f (S.index hs (op_Multiply 2 i)) (S.index hs (op_Multiply 2 i + 1)) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.