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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CBOR.Pulse.fst | CBOR.Pulse.i16_neq_0 | val i16_neq_0 (x: I16.t) : Tot bool | val i16_neq_0 (x: I16.t) : Tot bool | let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 45,
"end_line": 175,
"start_col": 0,
"start_line": 175
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
``` | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Int16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.Int16.t",
"Prims.op_disEquality",
"FStar.Int16.__int_to_t",
"Prims.bool"
] | [] | false | false | false | true | false | let i16_neq_0 (x: I16.t) : Tot bool =
| x <> 0s | false |
CBOR.Pulse.fst | CBOR.Pulse.size_eq | val size_eq (x1 x2: SZ.t) : Tot bool | val size_eq (x1 x2: SZ.t) : Tot bool | let size_eq (x1 x2: SZ.t) : Tot bool = x1 = x2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 46,
"end_line": 681,
"start_col": 0,
"start_line": 681
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m'
let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
)
let cbor_map_get_post_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(value: cbor)
: Tot vprop
= exists* vvalue.
raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue
)
let cbor_map_get_post
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
: Tot vprop
= match res with
| NotFound -> cbor_map_get_post_not_found p vkey vmap map
| Found value -> cbor_map_get_post_found p vkey vmap map value
let cbor_map_get_invariant
(pmap: perm)
(vkey: Ghost.erased Cbor.raw_data_item)
(vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop
= match res with
| Found value -> cbor_map_get_post_found pmap vkey vmap map value ** pure (
Cbor.Map? vmap /\
Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
)
| NotFound ->
cbor_map_iterator_match pmap i l **
(cbor_map_iterator_match pmap i l @==> raw_data_item_match pmap map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap) ==
list_ghost_assoc (Ghost.reveal vkey) l
)
```pulse
ghost
fn cbor_map_get_invariant_end
(pmap: perm)
(vkey: Ghost.erased Cbor.raw_data_item)
(vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(gres: Ghost.erased cbor_map_get_t)
(res: cbor_map_get_t)
(i: Ghost.erased cbor_map_iterator_t)
(l: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
requires
cbor_map_get_invariant pmap vkey vmap map gres i l **
pure (
(Nil? l \/ Found? gres) /\
res == Ghost.reveal gres
)
ensures
cbor_map_get_post pmap vkey vmap map res ** pure (
Cbor.Map? vmap /\
Found? res == Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
)
{
match res
{
NotFound ->
{
rewrite (cbor_map_get_invariant pmap vkey vmap map gres i l) // FIXME: WHY WHY WHY?
as (cbor_map_get_invariant pmap vkey vmap map NotFound i l);
unfold (cbor_map_get_invariant pmap vkey vmap map NotFound i l);
elim_stick0 ();
fold (cbor_map_get_post_not_found pmap vkey vmap map);
fold (cbor_map_get_post pmap vkey vmap map NotFound)
}
Found value ->
{
rewrite (cbor_map_get_invariant pmap vkey vmap map gres i l) // FIXME: WHY WHY WHY?
as (cbor_map_get_invariant pmap vkey vmap map (Found value) i l);
unfold (cbor_map_get_invariant pmap vkey vmap map (Found value) i l);
fold (cbor_map_get_post pmap vkey vmap map (Found value))
}
}
}
```
```pulse
fn cbor_map_get
(key: cbor)
(map: cbor)
(#pkey: perm)
(#pmap: perm)
(#vkey: Ghost.erased Cbor.raw_data_item)
(#vmap: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match pkey key vkey ** raw_data_item_match pmap map vmap ** pure (
Cbor.Map? vmap
))
returns res: cbor_map_get_t
ensures
(raw_data_item_match pkey key vkey ** cbor_map_get_post pmap vkey vmap map res ** pure (
Cbor.Map? vmap /\
Found? res == Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
))
{
let i0 = cbor_map_iterator_init map;
with l0 . assert (cbor_map_iterator_match pmap i0 l0);
let done0 = cbor_map_iterator_is_done i0;
let mut pi = i0;
let mut pres = NotFound;
let mut pdone = done0;
fold (cbor_map_get_invariant pmap vkey vmap map NotFound i0 l0);
while (
with gres i l . assert (pts_to pres gres ** pts_to pi i ** cbor_map_get_invariant pmap vkey vmap map gres i l);
let res = !pres;
let done = !pdone;
assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres i l); // FIXME: WHY WHY WHY?
not (done || Found? res)
)
invariant cont . exists* (done: bool) (res: cbor_map_get_t) (i: cbor_map_iterator_t) (l: list (Cbor.raw_data_item & Cbor.raw_data_item)) .
raw_data_item_match pkey key vkey **
pts_to pdone done **
pts_to pi i **
pts_to pres res **
cbor_map_get_invariant pmap vkey vmap map res i l **
pure (
done == Nil? l /\
cont == not (done || Found? res)
)
{
with gres gi l . assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres gi l);
rewrite each gres as NotFound;
unfold (cbor_map_get_invariant pmap vkey vmap map NotFound gi l);
let x = cbor_map_iterator_next pi;
stick_trans ();
with gi' l'. assert (cbor_map_iterator_match pmap gi' l');
with vx . assert (raw_data_item_map_entry_match pmap x vx);
rewrite_with_implies
(raw_data_item_map_entry_match pmap x vx)
(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx) **
raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx)
);
let test = cbor_is_equal key (cbor_map_entry_key x);
if (test) {
stick_consume_l ()
#(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx))
#(raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx));
stick_weaken_hyp_l
(raw_data_item_map_entry_match pmap x vx)
(cbor_map_iterator_match pmap gi' l');
stick_consume_r ()
#(raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx))
#(cbor_map_iterator_match pmap gi' l');
pres := Found (cbor_map_entry_value x);
fold (cbor_map_get_post_found pmap vkey vmap map (cbor_map_entry_value x));
fold (cbor_map_get_invariant pmap vkey vmap map (Found (cbor_map_entry_value x)) gi' l)
} else {
elim_stick0 ()
#(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx) ** raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx));
stick_consume_l ()
#(raw_data_item_map_entry_match pmap x vx)
#(cbor_map_iterator_match pmap gi' l');
let i' = !pi;
rewrite each gi' as i';
let done = cbor_map_iterator_is_done i';
pdone := done;
fold (cbor_map_get_invariant pmap vkey vmap map NotFound i' l')
}
};
with gres i l . assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres i l);
let res = !pres;
cbor_map_get_invariant_end pmap vkey vmap map gres res i l;
res
}
```
module SM = Pulse.Lib.SeqMatch
module AS = Pulse.Lib.ArraySwap
let cbor_map_sort_merge_invariant_prop
(lo: SZ.t)
(hi: SZ.t)
(l1_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(l2_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(cont: bool)
i1 i2 (res: bool) accu l1 l2
: Tot prop
=
SZ.v lo <= SZ.v i1 /\
SZ.v i1 <= SZ.v i2 /\
SZ.v i2 <= SZ.v hi /\
Cbor.map_sort_merge Cbor.cbor_compare [] l1_0 l2_0 == (
if res
then Cbor.map_sort_merge Cbor.cbor_compare accu l1 l2
else (false, accu `List.Tot.append` (l1 `List.Tot.append` l2))
) /\
cont == (res && not (i1 = i2 || i2 = hi))
let cbor_map_sort_merge_invariant // FIXME: WHY WHY WHY?
(a: A.array cbor_map_entry)
(lo: SZ.t)
(hi: SZ.t)
(l1_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(l2_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(pi1: ref SZ.t)
(pi2: ref SZ.t)
(pres: ref bool)
(cont: bool)
i1 i2 (res: bool) c c1 c2 accu l1 l2
: Tot vprop
=
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pres res **
A.pts_to_range a (SZ.v lo) (SZ.v i1) c **
SM.seq_list_match c accu (raw_data_item_map_entry_match full_perm) **
A.pts_to_range a (SZ.v i1) (SZ.v i2) c1 **
SM.seq_list_match c1 l1 (raw_data_item_map_entry_match full_perm) **
A.pts_to_range a (SZ.v i2) (SZ.v hi) c2 **
SM.seq_list_match c2 l2 (raw_data_item_map_entry_match full_perm) **
pure (cbor_map_sort_merge_invariant_prop lo hi l1_0 l2_0 cont i1 i2 res accu l1 l2)
inline_for_extraction noextract [@@noextract_to "krml"]
let size_add (x1 x2: SZ.t) (sq: squash (SZ.fits (SZ.v x1 + SZ.v x2))) : Tot SZ.t = x1 `SZ.add` x2 | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.ArraySwap",
"short_module": "AS"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.SeqMatch",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x1: FStar.SizeT.t -> x2: FStar.SizeT.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.SizeT.t",
"Prims.op_Equality",
"Prims.bool"
] | [] | false | false | false | true | false | let size_eq (x1 x2: SZ.t) : Tot bool =
| x1 = x2 | false |
CBOR.Pulse.fst | CBOR.Pulse.cbor_map_get_post_not_found | val cbor_map_get_post_not_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) : Tot vprop | val cbor_map_get_post_not_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) : Tot vprop | let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 447,
"start_col": 0,
"start_line": 438
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m' | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: PulseCore.FractionalPermission.perm ->
vkey: CBOR.Spec.Type.raw_data_item ->
vmap: CBOR.Spec.Type.raw_data_item ->
map: CBOR.Pulse.Type.cbor
-> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"PulseCore.FractionalPermission.perm",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Pulse.Type.cbor",
"Pulse.Lib.Core.op_Star_Star",
"CBOR.Pulse.Extern.raw_data_item_match",
"Pulse.Lib.Core.pure",
"Prims.l_and",
"Prims.b2t",
"CBOR.Spec.Type.uu___is_Map",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"CBOR.Pulse.list_ghost_assoc",
"CBOR.Spec.Type.__proj__Map__item__v",
"FStar.Pervasives.Native.None",
"Pulse.Lib.Core.vprop"
] | [] | false | false | false | true | false | let cbor_map_get_post_not_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) : Tot vprop =
| raw_data_item_match p map vmap **
pure (Cbor.Map? vmap /\ list_ghost_assoc vkey (Cbor.Map?.v vmap) == None) | false |
CBOR.Pulse.fst | CBOR.Pulse.cbor_map_get_post_found | val cbor_map_get_post_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map value: cbor) : Tot vprop | val cbor_map_get_post_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map value: cbor) : Tot vprop | let cbor_map_get_post_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(value: cbor)
: Tot vprop
= exists* vvalue.
raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue
) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 462,
"start_col": 0,
"start_line": 449
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m'
let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
) | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: PulseCore.FractionalPermission.perm ->
vkey: CBOR.Spec.Type.raw_data_item ->
vmap: CBOR.Spec.Type.raw_data_item ->
map: CBOR.Pulse.Type.cbor ->
value: CBOR.Pulse.Type.cbor
-> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"PulseCore.FractionalPermission.perm",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Pulse.Type.cbor",
"Pulse.Lib.Core.op_exists_Star",
"Pulse.Lib.Core.op_Star_Star",
"CBOR.Pulse.Extern.raw_data_item_match",
"Pulse.Lib.Stick.op_At_Equals_Equals_Greater",
"Pulse.Lib.Core.pure",
"Prims.l_and",
"Prims.b2t",
"CBOR.Spec.Type.uu___is_Map",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"CBOR.Pulse.list_ghost_assoc",
"CBOR.Spec.Type.__proj__Map__item__v",
"FStar.Pervasives.Native.Some",
"Pulse.Lib.Core.vprop"
] | [] | false | false | false | true | false | let cbor_map_get_post_found (p: perm) (vkey vmap: Cbor.raw_data_item) (map value: cbor) : Tot vprop =
| exists* vvalue.
(raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap)) **
pure (Cbor.Map? vmap /\ list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_lemma_Ghash_buffer_loop_body | val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0))))))))))))))) | val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0))))))))))))))) | let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) in_b)) 0 index')) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1249,
"start_col": 0,
"start_line": 1215
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_register va_b0 va_s0 hkeys_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok] in
let va_qc = va_qcode_Ghash_register va_mods hkeys_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_register ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 378 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Ghash_register hkeys_b h_BE y_prev va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_register (va_code_Ghash_register ()) va_s0 hkeys_b h_BE
y_prev in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_buffer_loop_body
val va_code_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_loop_body () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_GhashUnroll_n true) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_CCons
(va_code_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_CNil ())))))))))
val va_codegen_success_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_loop_body () =
(va_pbool_and (va_codegen_success_GhashUnroll_n true) (va_pbool_and (va_codegen_success_AddImm
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_pbool_and (va_codegen_success_SubImm
(va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_loop_body (va_mods:va_mods_t) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) (old_len:nat64) (index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 501 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (index + 2)) (fun _ -> let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) index (index + 2) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n true in_b index h_BE (Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index)) data) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg27:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg26:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg25:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg24:Vale.Def.Types_s.quad32) = y_prev in let (va_arg23:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg23 va_arg24 va_arg25
va_arg26 va_arg27 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906))
(i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t
(Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869
(FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 (index + 2)) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 (index + 2))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 507 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_QEmpty (()))))))))))))
val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
old_len: Vale.PPC64LE.Memory.nat64 ->
index: Prims.nat
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Memory.nat64",
"Prims.nat",
"Vale.PPC64LE.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer_loop_body",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.PPC64LE.QuickCodes.label",
"Vale.PPC64LE.QuickCodes.va_range1",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.int",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.buffer_length",
"Vale.PPC64LE.Memory.vuint128",
"Prims.op_LessThan",
"Prims.op_Multiply",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.GHash_BE.ghash_incremental0",
"FStar.Seq.Base.slice",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"Vale.PPC64LE.Decls.s128",
"Prims.op_Subtraction",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.AES.PPC64LE.GHash.va_qcode_Ghash_buffer_loop_body"
] | [] | false | false | false | false | false | let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
| let va_mods:va_mods_t =
[
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7; va_Mod_ok
]
in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in
label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM)
in_b
index'
(va_get_reg 6 va_sM)
(va_get_mem_layout va_sM)
Secret) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM) < pow2_64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet
1
va_sM)
in_b))
0
index')) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2))))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7; va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_wpProof_Ghash_buffer_while0 | val va_wpProof_Ghash_buffer_while0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_while0 ()) ([va_Mod_vec
9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Ghash_buffer_while0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_while0 ()) ([va_Mod_vec
9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
va_s0 va_k =
let (va_sM, va_f0, index) = va_lemma_Ghash_buffer_while0 (va_code_Ghash_buffer_while0 ()) va_s0
va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 1868,
"start_col": 0,
"start_line": 1855
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_register va_b0 va_s0 hkeys_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok] in
let va_qc = va_qcode_Ghash_register va_mods hkeys_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_register ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 378 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Ghash_register hkeys_b h_BE y_prev va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_register (va_code_Ghash_register ()) va_s0 hkeys_b h_BE
y_prev in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_buffer_loop_body
val va_code_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_loop_body () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_GhashUnroll_n true) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_CCons
(va_code_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_CNil ())))))))))
val va_codegen_success_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_loop_body () =
(va_pbool_and (va_codegen_success_GhashUnroll_n true) (va_pbool_and (va_codegen_success_AddImm
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_pbool_and (va_codegen_success_SubImm
(va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_loop_body (va_mods:va_mods_t) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) (old_len:nat64) (index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 501 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (index + 2)) (fun _ -> let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) index (index + 2) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n true in_b index h_BE (Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index)) data) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg27:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg26:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg25:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg24:Vale.Def.Types_s.quad32) = y_prev in let (va_arg23:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg23 va_arg24 va_arg25
va_arg26 va_arg27 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906))
(i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t
(Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869
(FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 (index + 2)) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 (index + 2))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 507 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_QEmpty (()))))))))))))
val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) in_b)) 0 index')) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6
va_s0 >= 2 /\ index + va_get_reg 6 va_s0 == old_len /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
in_b index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in_b)) 0 index) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall (va_x_r7:nat64)
(va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6
(va_upd_reg 7 va_x_r7 va_s0))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index + 2 in index' + va_get_reg 6
va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM)
in_b)) 0 index') /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 - 2) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer_loop_body : in_b:buffer128 -> h_BE:quad32 -> y_prev:quad32 ->
old_len:nat64 -> index:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_loop_body ())
([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_buffer_loop_body (va_code_Ghash_buffer_loop_body ()) va_s0
in_b h_BE y_prev old_len index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM
(va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body ())) =
(va_QProc (va_code_Ghash_buffer_loop_body ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_reg 6; va_Mod_reg 7]) (va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index)
(va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index))
//--
//-- Mod_cr0
val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Mod_cr0 () =
(va_Block (va_CNil ()))
val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Mod_cr0 () =
(va_ttrue ())
[@ "opaque_to_smt" va_qattr]
let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (())))
val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mod_cr0 ()) 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 /\
va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Mod_cr0 va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in
let va_qc = va_qcode_Mod_cr0 va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok
va_sM ==> va_k va_sM (())))
val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Mod_cr0 va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) =
(va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0)
//--
//-- Ghash_buffer_body0
val va_code_Ghash_buffer_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_body0 () =
(va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Ghash_buffer_loop_body ()) (va_CNil
()))))
val va_codegen_success_Ghash_buffer_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_body0 () =
(va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and
(va_codegen_success_Ghash_buffer_loop_body ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_body0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 595 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mod_cr0 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 596 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_loop_body in_b h_BE y_prev (va_get_reg 6 va_old) index) (fun
(va_s:va_state) _ -> let (index:nat) = index + 2 in va_QEmpty ((index))))))
val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_body0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_body0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_body0 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index)
[@ va_qattr]
let va_wp_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) (va_s0:va_state) (va_k:(va_state
-> nat -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0
== va_get_reg 7 va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s0) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2 /\ (forall (va_x_cr0:cr0_t) (va_x_ok:bool)
(va_x_r10:nat64) (va_x_r6:nat64) (va_x_r7:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (index:nat) . let va_sM = va_upd_vec 9 va_x_v9 (va_upd_vec 8
va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 11
va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 7
va_x_r7 (va_upd_reg 6 va_x_r6 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_cr0 va_x_cr0
va_s0))))))))))))) in va_get_ok va_sM /\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\
va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
1) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) ==> va_k va_sM ((index))))
val va_wpProof_Ghash_buffer_body0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
va_s0 va_k =
let (va_sM, va_f0, index) = va_lemma_Ghash_buffer_body0 (va_code_Ghash_buffer_body0 ()) va_s0
va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) : (va_quickCode nat
(va_code_Ghash_buffer_body0 ())) =
(va_QProc (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7;
va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) (va_wp_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index) (va_wpProof_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index))
//--
//-- Ghash_buffer_while0
val va_code_Ghash_buffer_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_while0 () =
(va_Block (va_CCons (va_While (va_cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (va_Block (va_CCons
(va_code_Ghash_buffer_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Ghash_buffer_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_while0 () =
(va_pbool_and (va_codegen_success_Ghash_buffer_body0 ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_while0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_while0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qWhile va_mods (Cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (fun va_g -> let (index:nat) =
let index = va_g in index in qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_body0 va_old h h_BE in_b y_prev index) (fun (va_s:va_state) (index:nat)
-> va_QEmpty ((index))))) (fun (va_s:va_state) va_g -> let (index:nat) = let index = va_g in
index in va_get_ok va_s /\ index + va_get_reg 6 va_s == va_get_reg 6 va_old /\ va_get_reg 7
va_s == va_get_reg 7 va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) in_b
index (va_get_reg 6 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_old /\ va_get_reg 7 va_s + 16
`op_Multiply` va_get_reg 6 va_s < pow2_64 /\ va_get_vec 1 va_s ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_s == va_get_vec 1 va_old) /\ h
== Vale.Math.Poly2.Bits_s.of_quad32 h_BE) (fun (va_s:va_state) va_g -> let (index:nat) = let
index = va_g in index in va_get_reg 6 va_s) ((index))) (fun (va_s:va_state) va_g -> let
(index:nat) = let index = va_g in index in let va_g = (index) in let (index:nat) = va_g in
va_QEmpty ((index)))))
val va_lemma_Ghash_buffer_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) /\ va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM
(va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM
va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_while0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_while0 va_mods va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_while0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(~(va_get_reg 6 va_sM >= 2))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index)
[@ va_qattr]
let va_wp_Ghash_buffer_while0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) (va_s0:va_state) (va_k:(va_state
-> nat -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0
== va_get_reg 7 va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s0) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ (forall (va_x_cr0:cr0_t) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r6:nat64)
(va_x_r7:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v10:quad32) (va_x_v11:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(index:nat) . let va_sM = va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4
(va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 7 va_x_r7 (va_upd_reg 6 va_x_r6
(va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_cr0 va_x_cr0 va_s0))))))))))))) in va_get_ok
va_sM /\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg
7 va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) ==> va_k va_sM ((index))))
val va_wpProof_Ghash_buffer_while0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_while0 ()) ([va_Mod_vec
9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_old: Vale.PPC64LE.Decls.va_state ->
va_in_h: Vale.Math.Poly2_s.poly ->
va_in_h_BE: Vale.PPC64LE.Memory.quad32 ->
va_in_in_b: Vale.PPC64LE.Memory.buffer128 ->
va_in_y_prev: Vale.PPC64LE.Memory.quad32 ->
va_in_index: Prims.nat ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.nat -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.nat) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Prims.unit",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Vale.PPC64LE.QuickCode.va_Mod_cr0",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_cr0",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.GHash.va_lemma_Ghash_buffer_while0",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer_while0"
] | [] | false | false | false | false | false | let va_wpProof_Ghash_buffer_while0
va_old
va_in_h
va_in_h_BE
va_in_in_b
va_in_y_prev
va_in_index
va_s0
va_k
=
| let va_sM, va_f0, index =
va_lemma_Ghash_buffer_while0 (va_code_Ghash_buffer_while0 ())
va_s0
va_old
va_in_h
va_in_h_BE
va_in_in_b
va_in_y_prev
va_in_index
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 9
va_sM
(va_update_vec 8
va_sM
(va_update_vec 4
va_sM
(va_update_vec 3
va_sM
(va_update_vec 2
va_sM
(va_update_vec 11
va_sM
(va_update_vec 10
va_sM
(va_update_vec 1
va_sM
(va_update_vec 0
va_sM
(va_update_reg 7
va_sM
(va_update_reg 6
va_sM
(va_update_reg 10
va_sM
(va_update_ok va_sM
(va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10;
va_Mod_ok; va_Mod_cr0
])
va_sM
va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_aesni_support | val va_wp_Check_aesni_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_aesni_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 21,
"end_line": 43,
"start_col": 0,
"start_line": 37
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.aesni_enabled",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_aesni_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_sha_support | val va_wp_Check_sha_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_sha_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 77,
"start_col": 0,
"start_line": 72
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.sha_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_sha_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_lemma_Ghash_buffer | val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_BE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers hkeys_b (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) /\ va_state_eq va_sM (va_update_cr0 va_sM
(va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM
(va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM
(va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_ok va_sM va_s0)))))))))))))))))))))) | val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_BE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers hkeys_b (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) /\ va_state_eq va_sM (va_update_cr0 va_sM
(va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM
(va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM
(va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_ok va_sM va_s0)))))))))))))))))))))) | let va_lemma_Ghash_buffer va_b0 va_s0 hkeys_b in_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5;
va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg
6; va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer va_mods hkeys_b in_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in label va_range1
"***** POSTCONDITION NOT MET AT line 545 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM)
in_b))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 546 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_s0 == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_cr0; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 2054,
"start_col": 0,
"start_line": 2033
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_register va_b0 va_s0 hkeys_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok] in
let va_qc = va_qcode_Ghash_register va_mods hkeys_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_register ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 378 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Ghash_register hkeys_b h_BE y_prev va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_register (va_code_Ghash_register ()) va_s0 hkeys_b h_BE
y_prev in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_buffer_loop_body
val va_code_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_loop_body () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_GhashUnroll_n true) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_CCons
(va_code_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_CNil ())))))))))
val va_codegen_success_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_loop_body () =
(va_pbool_and (va_codegen_success_GhashUnroll_n true) (va_pbool_and (va_codegen_success_AddImm
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_pbool_and (va_codegen_success_SubImm
(va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_loop_body (va_mods:va_mods_t) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) (old_len:nat64) (index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 501 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (index + 2)) (fun _ -> let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) index (index + 2) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n true in_b index h_BE (Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index)) data) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg27:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg26:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg25:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg24:Vale.Def.Types_s.quad32) = y_prev in let (va_arg23:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg23 va_arg24 va_arg25
va_arg26 va_arg27 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906))
(i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t
(Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869
(FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 (index + 2)) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 (index + 2))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 507 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_QEmpty (()))))))))))))
val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) in_b)) 0 index')) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6
va_s0 >= 2 /\ index + va_get_reg 6 va_s0 == old_len /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
in_b index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in_b)) 0 index) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall (va_x_r7:nat64)
(va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6
(va_upd_reg 7 va_x_r7 va_s0))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index + 2 in index' + va_get_reg 6
va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM)
in_b)) 0 index') /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 - 2) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer_loop_body : in_b:buffer128 -> h_BE:quad32 -> y_prev:quad32 ->
old_len:nat64 -> index:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_loop_body ())
([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_buffer_loop_body (va_code_Ghash_buffer_loop_body ()) va_s0
in_b h_BE y_prev old_len index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM
(va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body ())) =
(va_QProc (va_code_Ghash_buffer_loop_body ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_reg 6; va_Mod_reg 7]) (va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index)
(va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index))
//--
//-- Mod_cr0
val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Mod_cr0 () =
(va_Block (va_CNil ()))
val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Mod_cr0 () =
(va_ttrue ())
[@ "opaque_to_smt" va_qattr]
let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (())))
val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mod_cr0 ()) 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 /\
va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Mod_cr0 va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in
let va_qc = va_qcode_Mod_cr0 va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok
va_sM ==> va_k va_sM (())))
val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Mod_cr0 va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) =
(va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0)
//--
//-- Ghash_buffer_body0
val va_code_Ghash_buffer_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_body0 () =
(va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Ghash_buffer_loop_body ()) (va_CNil
()))))
val va_codegen_success_Ghash_buffer_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_body0 () =
(va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and
(va_codegen_success_Ghash_buffer_loop_body ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_body0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 595 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mod_cr0 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 596 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_loop_body in_b h_BE y_prev (va_get_reg 6 va_old) index) (fun
(va_s:va_state) _ -> let (index:nat) = index + 2 in va_QEmpty ((index))))))
val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_body0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_body0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_body0 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index)
[@ va_qattr]
let va_wp_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) (va_s0:va_state) (va_k:(va_state
-> nat -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0
== va_get_reg 7 va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s0) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2 /\ (forall (va_x_cr0:cr0_t) (va_x_ok:bool)
(va_x_r10:nat64) (va_x_r6:nat64) (va_x_r7:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (index:nat) . let va_sM = va_upd_vec 9 va_x_v9 (va_upd_vec 8
va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 11
va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 7
va_x_r7 (va_upd_reg 6 va_x_r6 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_cr0 va_x_cr0
va_s0))))))))))))) in va_get_ok va_sM /\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\
va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
1) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) ==> va_k va_sM ((index))))
val va_wpProof_Ghash_buffer_body0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
va_s0 va_k =
let (va_sM, va_f0, index) = va_lemma_Ghash_buffer_body0 (va_code_Ghash_buffer_body0 ()) va_s0
va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) : (va_quickCode nat
(va_code_Ghash_buffer_body0 ())) =
(va_QProc (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7;
va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) (va_wp_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index) (va_wpProof_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index))
//--
//-- Ghash_buffer_while0
val va_code_Ghash_buffer_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_while0 () =
(va_Block (va_CCons (va_While (va_cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (va_Block (va_CCons
(va_code_Ghash_buffer_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Ghash_buffer_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_while0 () =
(va_pbool_and (va_codegen_success_Ghash_buffer_body0 ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_while0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_while0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qWhile va_mods (Cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (fun va_g -> let (index:nat) =
let index = va_g in index in qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_body0 va_old h h_BE in_b y_prev index) (fun (va_s:va_state) (index:nat)
-> va_QEmpty ((index))))) (fun (va_s:va_state) va_g -> let (index:nat) = let index = va_g in
index in va_get_ok va_s /\ index + va_get_reg 6 va_s == va_get_reg 6 va_old /\ va_get_reg 7
va_s == va_get_reg 7 va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) in_b
index (va_get_reg 6 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_old /\ va_get_reg 7 va_s + 16
`op_Multiply` va_get_reg 6 va_s < pow2_64 /\ va_get_vec 1 va_s ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_s == va_get_vec 1 va_old) /\ h
== Vale.Math.Poly2.Bits_s.of_quad32 h_BE) (fun (va_s:va_state) va_g -> let (index:nat) = let
index = va_g in index in va_get_reg 6 va_s) ((index))) (fun (va_s:va_state) va_g -> let
(index:nat) = let index = va_g in index in let va_g = (index) in let (index:nat) = va_g in
va_QEmpty ((index)))))
val va_lemma_Ghash_buffer_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) /\ va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM
(va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM
va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_while0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_while0 va_mods va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_while0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(~(va_get_reg 6 va_sM >= 2))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index)
[@ va_qattr]
let va_wp_Ghash_buffer_while0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) (va_s0:va_state) (va_k:(va_state
-> nat -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0
== va_get_reg 7 va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s0) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ (forall (va_x_cr0:cr0_t) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r6:nat64)
(va_x_r7:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v10:quad32) (va_x_v11:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(index:nat) . let va_sM = va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4
(va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 7 va_x_r7 (va_upd_reg 6 va_x_r6
(va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_cr0 va_x_cr0 va_s0))))))))))))) in va_get_ok
va_sM /\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg
7 va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) ==> va_k va_sM ((index))))
val va_wpProof_Ghash_buffer_while0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_while0 ()) ([va_Mod_vec
9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_while0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
va_s0 va_k =
let (va_sM, va_f0, index) = va_lemma_Ghash_buffer_while0 (va_code_Ghash_buffer_while0 ()) va_s0
va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_while0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) : (va_quickCode nat
(va_code_Ghash_buffer_while0 ())) =
(va_QProc (va_code_Ghash_buffer_while0 ()) ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7;
va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) (va_wp_Ghash_buffer_while0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index) (va_wpProof_Ghash_buffer_while0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index))
//--
//-- Ghash_buffer
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 12) (va_op_reg_opr_reg 5) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec
7) (va_op_vec_opr_vec 5)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 12))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 12)) (va_CCons
(va_code_Ghash_buffer_while0 ()) (va_CCons (va_IfElse (va_cmp_gt (va_op_cmp_reg 6)
(va_const_cmp 0)) (va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_GhashUnroll_n
false) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))
(va_Block (va_CNil ()))) (va_CNil ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 12) (va_op_reg_opr_reg 5) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_High64ToLow (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Ghash_buffer_while0 ()) (va_pbool_and (va_codegen_success_GhashUnroll_n
false) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer (va_mods:va_mods_t) (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) : (va_quickCode unit (va_code_Ghash_buffer ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 548 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 549 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 550 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 12)
(va_op_reg_opr_reg 5) (va_op_reg_opr_reg 10) Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 551 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 553 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg61:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 554 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg61) (let
(va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 555 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg60) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 556 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg59) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 557 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 558 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 559 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg58) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 560 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg57) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 562 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 12)) (fun (va_s:va_state) _ -> let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 563 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg56) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 564 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg55) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 2) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 565 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 566 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 567 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 12) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64)) (fun (va_s:va_state) _ -> let
(va_arg53:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 568 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg53) (let
(va_arg52:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 569 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg52) (let (index:nat) = 0 in
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 572 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_while0 va_old_s h h_BE in_b y_prev index) (fun (va_s:va_state) index ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 600 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qIf va_mods (Cmp_gt (va_op_cmp_reg 6) (va_const_cmp 0)) (qblock va_mods (fun
(va_s:va_state) -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 601 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (va_get_reg 6 va_old_s)) (fun _ -> let
(data:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (va_get_reg 6 va_old_s) in let (y_loop:quad32) =
va_get_vec 1 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 604 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n false in_b index h_BE y_loop data) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 605 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg51:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg50:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg49:Vale.Def.Types_s.quad32) = y_loop in let (va_arg48:Vale.Def.Types_s.quad32) = y_prev
in let (va_arg47:Vale.Def.Types_s.quad32) = h_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 605 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg47 va_arg48 va_arg49
va_arg50 va_arg51 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 607 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 607 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b))) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun
(va_s:va_state) va_g -> va_QEmpty (()))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_cr0",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.PPC64LE.QuickCodes.label",
"Vale.PPC64LE.QuickCodes.va_range1",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.GHash_BE.ghash_incremental0",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"Vale.PPC64LE.Decls.s128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Prims.l_imp",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Machine_s.quad32",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.AES.PPC64LE.GHash.va_qcode_Ghash_buffer"
] | [] | false | false | false | false | false | let va_lemma_Ghash_buffer va_b0 va_s0 hkeys_b in_b h_BE y_prev =
| let va_mods:va_mods_t =
[
va_Mod_cr0; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7; va_Mod_ok
]
in
let va_qc = va_qcode_Ghash_buffer va_mods hkeys_b in_b h_BE y_prev in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Ghash_buffer ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\
(let h:poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
label va_range1
"***** POSTCONDITION NOT MET AT line 545 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet
1
va_sM)
in_b))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 546 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_s0 == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_s0)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_cr0; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_avx2_support | val va_wp_Check_avx2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_avx2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 99,
"end_line": 180,
"start_col": 0,
"start_line": 175
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.avx2_cpuid_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_avx2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_adx_bmi2_support | val va_wp_Check_adx_bmi2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_adx_bmi2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 112,
"start_col": 0,
"start_line": 106
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.adx_enabled",
"Vale.X64.CPU_Features_s.bmi2_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_adx_bmi2_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_avx_support | val va_wp_Check_avx_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_avx_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 98,
"end_line": 146,
"start_col": 0,
"start_line": 141
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.avx_cpuid_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_avx_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_movbe_support | val va_wp_Check_movbe_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_movbe_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 94,
"end_line": 214,
"start_col": 0,
"start_line": 209
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.movbe_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_movbe_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_qcode_Ghash_register | val va_qcode_Ghash_register (va_mods: va_mods_t) (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | val va_qcode_Ghash_register (va_mods: va_mods_t) (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))))))))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 95,
"end_line": 1050,
"start_col": 0,
"start_line": 932
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
())))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.GHash.va_code_Ghash_register ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Vspltisw",
"Vale.AES.PPC64LE.PolyOps.va_code_VSwap",
"Vale.AES.PPC64LE.GF128_Mul.va_code_High64ToLow",
"Vale.AES.PPC64LE.GF128_Mul.va_code_Low64ToHigh",
"Vale.PPC64LE.Machine_s.Block",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.AES.PPC64LE.PolyOps.va_code_VPolyAdd",
"Vale.AES.PPC64LE.PolyOps.va_code_VPolyMulLow",
"Vale.AES.PPC64LE.PolyOps.va_code_VPolyMul",
"Vale.AES.PPC64LE.PolyOps.va_code_VPolyMulHigh",
"Vale.PPC64LE.InsBasic.va_code_LoadImmShl64",
"Prims.op_Minus",
"Vale.PPC64LE.InsVector.va_code_Mtvsrws",
"Vale.PPC64LE.InsVector.va_code_Vsldoi",
"Vale.AES.PPC64LE.GHash.va_code_ReduceLast",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.PPC64LE.InsVector.va_quick_Load128_byte16_buffer",
"Vale.PPC64LE.InsVector.va_quick_Vspltisw",
"Vale.PPC64LE.QuickCodes.va_QBind",
"Vale.AES.PPC64LE.PolyOps.va_quick_VSwap",
"Vale.PPC64LE.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Vale.Math.Poly2_s.degree",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_double32",
"Vale.Arch.Types.quad32_double_lo",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.Math.Poly2_s.mod",
"Vale.Math.Poly2_s.monomial",
"Vale.Arch.Types.quad32_double_hi",
"Vale.Math.Poly2_s.div",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2_s.mul",
"Vale.Math.Poly2_s.shift",
"Vale.Math.Poly2.Bits.lemma_quad32_double",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.four",
"Vale.Math.Poly2.swap",
"Vale.Def.Words_s.Mkfour",
"Prims.logical",
"Vale.Math.Poly2.Words.lemma_quad32_double_swap",
"Vale.AES.PPC64LE.GF128_Mul.va_quick_High64ToLow",
"Vale.AES.GHash_BE.gf128_power",
"Vale.AES.PPC64LE.GF128_Mul.va_quick_Low64ToHigh",
"Prims.op_LessThan",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2.Bits.lemma_of_to_quad32",
"Vale.PPC64LE.QuickCodes.va_qAssertSquash",
"Prims.op_GreaterThanOrEqual",
"FStar.Seq.Base.length",
"Prims.nat",
"Prims.squash",
"Vale.PPC64LE.QuickCodes.va_qAssert",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"FStar.Seq.Base.index",
"Prims.l_True",
"Vale.AES.GF128.shift_key_1",
"Vale.AES.GF128_s.gf128_modulus_low_terms",
"Vale.AES.GHash_BE.g_power",
"Vale.AES.GHash_BE.lemma_gf128_power",
"Vale.AES.PPC64LE.PolyOps.va_quick_VPolyAdd",
"Vale.Math.Poly2_s.zero",
"Vale.Math.Poly2.Lemmas.lemma_degree_negative",
"Vale.Math.Poly2.Lemmas.lemma_shift_is_div",
"Vale.AES.PPC64LE.PolyOps.va_quick_VPolyMulLow",
"Vale.AES.PPC64LE.PolyOps.va_quick_VPolyMul",
"Vale.Math.Poly2.Lemmas.lemma_div_mod_exact",
"Vale.Math.Poly2.mask",
"Vale.Math.Poly2.Lemmas.lemma_mask_is_mod",
"Vale.AES.PPC64LE.PolyOps.va_quick_VPolyMulHigh",
"Vale.Math.Poly2.Lemmas.lemma_mod_mod",
"Vale.AES.GHash_BE.lemma_swap128_mask_shift",
"Vale.AES.GF128.lemma_Mul128",
"Vale.PPC64LE.InsBasic.va_quick_LoadImmShl64",
"Prims.int",
"Vale.Def.Types_s.ishl",
"Prims.op_Modulus",
"Prims.op_Multiply",
"Prims.pow2",
"Vale.AES.Types_helpers.lemma_ishl_64",
"Vale.PPC64LE.InsVector.va_quick_Mtvsrws",
"Vale.PPC64LE.InsVector.va_quick_Vsldoi",
"Vale.AES.PPC64LE.GHash.va_quick_ReduceLast",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.Def.Words_s.nat64",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.AES.GHash_BE.poly128",
"Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.create",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_register"
] | [] | false | false | false | false | false | let va_qcode_Ghash_register (va_mods: va_mods_t) (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let data:(FStar.Seq.Base.seq quad32) =
FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s)
in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5)
Secret
hkeys_b
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(fun (va_s: va_state) _ ->
let va_arg71:Vale.Math.Poly2_s.poly = Vale.AES.GHash_BE.gf128_power h 1 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71)
(let va_arg70:Vale.Math.Poly2_s.poly = Vale.AES.GHash_BE.gf128_power h 1 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70)
(let va_arg69:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)
(Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)
(Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1
)
64))
(fun (va_s: va_state) _ ->
let va_arg68:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h
1)
(Vale.Math.Poly2_s.monomial 64)
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68)
(let va_arg67:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power
h
1)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67
)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\
(fun
a_539
(s_540: (FStar.Seq.Base.seq a_539))
(i_541: Prims.nat)
->
let i_515:Prims.nat = i_541 in
Prims.b2t (Prims.op_LessThan i_515
(FStar.Seq.Base.length #a_539
s_540))) quad32
data
0)
(fun _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s ==
FStar.Seq.Base.index #quad32 data 0)
(let data_i:poly = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.AES.GHash_BE.lemma_gf128_power
h
1)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec
9)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9))
(fun (va_s: va_state) _ ->
let va_arg66:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s))
(Vale.Math.Poly2_s.monomial
64)
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Lemmas.lemma_degree_negative
va_arg66)
(let va_arg65:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Lemmas.lemma_shift_is_div
va_arg65
64)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow
(va_op_vec_opr_vec
2)
(va_op_vec_opr_vec
9)
(va_op_vec_opr_vec
7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul
(va_op_vec_opr_vec
3)
(va_op_vec_opr_vec
9)
(va_op_vec_opr_vec
5))
(fun
(va_s:
va_state
)
_
->
let
va_arg64:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.monomial
64
in
let
va_arg63:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power
h
1)
(Vale.Math.Poly2_s.monomial
64
)
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun
(_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_div_mod_exact
va_arg63
va_arg64
)
(let
va_arg62:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec
6
va_s
)
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_mask_is_mod
va_arg62
64
)
(va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_VPolyMulHigh
(
va_op_vec_opr_vec
4
)
(
va_op_vec_opr_vec
9
)
(
va_op_vec_opr_vec
6
)
)
(
fun
(
va_s:
va_state
)
_
->
let
va_arg61:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.monomial
64
in
let
va_arg60:Vale.Math.Poly2_s.poly
=
Vale.AES.GHash_BE.gf128_power
h
1
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_mod_mod
va_arg60
va_arg61
)
(
let
va_arg59:Vale.Math.Poly2_s.poly
=
Vale.AES.GHash_BE.gf128_power
h
1
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_mask_is_mod
va_arg59
64
)
(
let
va_arg58:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.mod
(
Vale.AES.GHash_BE.gf128_power
h
1
)
(
Vale.Math.Poly2_s.monomial
64
)
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_mask_is_mod
va_arg58
64
)
(
let
va_arg57:Vale.Math.Poly2_s.poly
=
Vale.AES.GHash_BE.gf128_power
h
1
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.GHash_BE.lemma_swap128_mask_shift
va_arg57
)
(
let
va_arg56:Vale.Math.Poly2_s.poly
=
Vale.AES.GHash_BE.gf128_power
h
1
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_shift_is_div
va_arg56
64
)
(
let
va_arg55:Vale.Math.Poly2_s.poly
=
Vale.Math.Poly2_s.mul
(
Vale.Math.Poly2_s.div
(
Vale.AES.GHash_BE.gf128_power
h
1
)
(
Vale.Math.Poly2_s.monomial
64
)
)
(
Vale.Math.Poly2_s.monomial
64
)
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.Math.Poly2.Lemmas.lemma_shift_is_div
va_arg55
64
)
(
let
va_arg54:Vale.Math.Poly2_s.poly
=
Vale.AES.GHash_BE.gf128_power
h
1
in
let
va_arg53:Vale.Math.Poly2_s.poly
=
add
prev
data_i
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.GF128.lemma_Mul128
va_arg53
va_arg54
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_Vspltisw
(
va_op_vec_opr_vec
8
)
0
)
(
va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_LoadImmShl64
(
va_op_reg_opr_reg
10
)
(
-
15872
)
)
(
fun
(
va_s:
va_state
)
_
->
let
va_arg52:Vale.Def.Types_s.nat64
=
(
-
15872
)
`op_Modulus`
pow2_64
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.Types_helpers.lemma_ishl_64
va_arg52
16
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_Mtvsrws
(
va_op_vec_opr_vec
0
)
(
va_op_reg_opr_reg
10
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_Vsldoi
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
8
)
(
va_op_vec_opr_vec
0
)
4
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_Vsldoi
(
va_op_vec_opr_vec
8
)
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
8
)
4
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(
va_quick_ReduceLast
h_BE
y_prev
data
)
(
va_QEmpty
(
()
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
))
))))))))))))))
)))))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_osxsave_support | val va_wp_Check_osxsave_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_osxsave_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 96,
"end_line": 353,
"start_col": 0,
"start_line": 348
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.osxsave_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_osxsave_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_avx512_support | val va_wp_Check_avx512_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_avx512_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 10,
"end_line": 319,
"start_col": 0,
"start_line": 312
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.avx512_cpuid_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_avx512_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_r10: nat64)
(va_x_r11: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rR10
va_x_r10
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_rdrand_support | val va_wp_Check_rdrand_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_rdrand_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 95,
"end_line": 282,
"start_col": 0,
"start_line": 277
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.rdrand_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_rdrand_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_lemma_Ghash_buffer_body0 | val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0)))))))))))))))) | val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0)))))))))))))))) | let va_lemma_Ghash_buffer_body0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_body0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_body0 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 1525,
"start_col": 0,
"start_line": 1466
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_register va_b0 va_s0 hkeys_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok] in
let va_qc = va_qcode_Ghash_register va_mods hkeys_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_register ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 378 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Ghash_register hkeys_b h_BE y_prev va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_register (va_code_Ghash_register ()) va_s0 hkeys_b h_BE
y_prev in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_buffer_loop_body
val va_code_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_loop_body () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_GhashUnroll_n true) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_CCons
(va_code_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_CNil ())))))))))
val va_codegen_success_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_loop_body () =
(va_pbool_and (va_codegen_success_GhashUnroll_n true) (va_pbool_and (va_codegen_success_AddImm
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_pbool_and (va_codegen_success_SubImm
(va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_loop_body (va_mods:va_mods_t) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) (old_len:nat64) (index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 501 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (index + 2)) (fun _ -> let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) index (index + 2) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n true in_b index h_BE (Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index)) data) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg27:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg26:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg25:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg24:Vale.Def.Types_s.quad32) = y_prev in let (va_arg23:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg23 va_arg24 va_arg25
va_arg26 va_arg27 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906))
(i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t
(Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869
(FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 (index + 2)) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 (index + 2))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 507 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_QEmpty (()))))))))))))
val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) in_b)) 0 index')) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6
va_s0 >= 2 /\ index + va_get_reg 6 va_s0 == old_len /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
in_b index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in_b)) 0 index) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall (va_x_r7:nat64)
(va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6
(va_upd_reg 7 va_x_r7 va_s0))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index + 2 in index' + va_get_reg 6
va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM)
in_b)) 0 index') /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 - 2) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer_loop_body : in_b:buffer128 -> h_BE:quad32 -> y_prev:quad32 ->
old_len:nat64 -> index:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_loop_body ())
([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_buffer_loop_body (va_code_Ghash_buffer_loop_body ()) va_s0
in_b h_BE y_prev old_len index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM
(va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body ())) =
(va_QProc (va_code_Ghash_buffer_loop_body ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_reg 6; va_Mod_reg 7]) (va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index)
(va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index))
//--
//-- Mod_cr0
val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Mod_cr0 () =
(va_Block (va_CNil ()))
val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Mod_cr0 () =
(va_ttrue ())
[@ "opaque_to_smt" va_qattr]
let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (())))
val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mod_cr0 ()) 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 /\
va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Mod_cr0 va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in
let va_qc = va_qcode_Mod_cr0 va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok
va_sM ==> va_k va_sM (())))
val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Mod_cr0 va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) =
(va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0)
//--
//-- Ghash_buffer_body0
val va_code_Ghash_buffer_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_body0 () =
(va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Ghash_buffer_loop_body ()) (va_CNil
()))))
val va_codegen_success_Ghash_buffer_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_body0 () =
(va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and
(va_codegen_success_Ghash_buffer_loop_body ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_body0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 595 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mod_cr0 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 596 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_loop_body in_b h_BE y_prev (va_get_reg 6 va_old) index) (fun
(va_s:va_state) _ -> let (index:nat) = index + 2 in va_QEmpty ((index))))))
val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0)))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_old: Vale.PPC64LE.Decls.va_state ->
va_in_h: Vale.Math.Poly2_s.poly ->
va_in_h_BE: Vale.PPC64LE.Memory.quad32 ->
va_in_in_b: Vale.PPC64LE.Memory.buffer128 ->
va_in_y_prev: Vale.PPC64LE.Memory.quad32 ->
va_in_index: Prims.nat
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.nat) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.PPC64LE.QuickCodes.fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Vale.PPC64LE.QuickCode.va_Mod_cr0",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer_body0",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.PPC64LE.QuickCodes.label",
"Vale.PPC64LE.QuickCodes.va_range1",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.int",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Multiply",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.Math.Poly2.swap",
"Vale.AES.GHash_BE.gf128_power",
"Vale.Math.Poly2_s.mul",
"Vale.Math.Poly2_s.div",
"Vale.Math.Poly2_s.monomial",
"Vale.Math.Poly2_s.mod",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.buffer_length",
"Vale.PPC64LE.Memory.vuint128",
"Prims.op_LessThan",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash_BE.ghash_incremental0",
"FStar.Seq.Base.slice",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"Vale.PPC64LE.Decls.s128",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.quad32",
"Vale.PPC64LE.QuickCodes.precedes_wrap",
"Vale.PPC64LE.Machine_s.nat64",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.AES.PPC64LE.GHash.va_qcode_Ghash_buffer_body0",
"Vale.PPC64LE.Decls.va_expand_state"
] | [] | false | false | false | false | false | let va_lemma_Ghash_buffer_body0
va_b0
va_s0
va_old
va_in_h
va_in_h_BE
va_in_in_b
va_in_y_prev
va_in_index
=
| let va_old = va_expand_state va_old in
let va_mods:va_mods_t =
[
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok;
va_Mod_cr0
]
in
let va_qc =
va_qcode_Ghash_buffer_body0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Ghash_buffer_body0 ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let index = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1)
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 2)
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM)
va_in_in_b
index
(va_get_reg 6 va_sM)
(va_get_mem_layout va_sM)
Secret) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b ==
va_get_reg 6 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM) < pow2_64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE
va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet
1
va_sM)
va_in_in_b))
0
index)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10;
va_Mod_ok; va_Mod_cr0
])
va_sM
va_s0;
let index = va_g in
(va_sM, va_fM, index) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_avx_xcr0_support | val va_wp_Check_avx_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_avx_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_avx_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 386,
"start_col": 0,
"start_line": 382
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_osxsave_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_osxsave_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_osxsave_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
(va_QProc (va_code_Check_osxsave_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support)
//--
//-- Check_avx_xcr0_support
val va_code_Check_avx_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_xcr0_support ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\ va_state_eq va_sM (va_update_flags 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))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.osxsave_enabled",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.avx_xcr0",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_avx_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\ osxsave_enabled /\
(forall (va_x_rax: nat64) (va_x_rcx: nat64) (va_x_rdx: nat64) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(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 /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) ==> va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_sse_support | val va_wp_Check_sse_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_sse_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 248,
"start_col": 0,
"start_line": 243
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_sse_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(forall (va_x_rax: nat64)
(va_x_rbx: nat64)
(va_x_rcx: nat64)
(va_x_rdx: nat64)
(va_x_r9: nat64)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0)))))
in
va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\
va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (()))) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_wp_Check_avx512_xcr0_support | val va_wp_Check_avx512_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Check_avx512_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Check_avx512_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ avx_xcr0 /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64)
(va_x_rdx:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 82,
"end_line": 418,
"start_col": 0,
"start_line": 414
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_osxsave_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_osxsave_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_osxsave_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
(va_QProc (va_code_Check_osxsave_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support)
//--
//-- Check_avx_xcr0_support
val va_code_Check_avx_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_xcr0_support ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\ va_state_eq va_sM (va_update_flags 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_qattr]
let va_wp_Check_avx_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) ==> va_k va_sM (())))
val va_wpProof_Check_avx_xcr0_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_xcr0_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_xcr0_support ())
([va_Mod_flags; 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" va_qattr]
let va_quick_Check_avx_xcr0_support () : (va_quickCode unit (va_code_Check_avx_xcr0_support ())) =
(va_QProc (va_code_Check_avx_xcr0_support ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRax]) va_wp_Check_avx_xcr0_support va_wpProof_Check_avx_xcr0_support)
//--
//-- Check_avx512_xcr0_support
val va_code_Check_avx512_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_xcr0_support ()) va_s0 /\ va_get_ok va_s0
/\ osxsave_enabled /\ avx_xcr0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) /\ va_state_eq va_sM (va_update_flags 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))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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 | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.osxsave_enabled",
"Vale.X64.CPU_Features_s.avx_xcr0",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.avx512_xcr0",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx"
] | [] | false | false | false | true | true | let va_wp_Check_avx512_xcr0_support (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\ osxsave_enabled /\ avx_xcr0 /\
(forall (va_x_rax: nat64) (va_x_rcx: nat64) (va_x_rdx: nat64) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(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 /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) ==> va_k va_sM (()))) | false |
CBOR.Pulse.fst | CBOR.Pulse.list_ghost_assoc | val list_ghost_assoc (#key #value: Type) (k: key) (m: list (key & value))
: GTot (option value) (decreases m) | val list_ghost_assoc (#key #value: Type) (k: key) (m: list (key & value))
: GTot (option value) (decreases m) | let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m' | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 30,
"end_line": 436,
"start_col": 0,
"start_line": 424
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"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 | k: key -> m: Prims.list (key * value) -> Prims.GTot (FStar.Pervasives.Native.option value) | Prims.GTot | [
"sometrivial",
""
] | [] | [
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.None",
"FStar.StrongExcludedMiddle.strong_excluded_middle",
"Prims.eq2",
"FStar.Pervasives.Native.Some",
"Prims.bool",
"CBOR.Pulse.list_ghost_assoc",
"FStar.Pervasives.Native.option"
] | [
"recursion"
] | false | false | false | false | false | let rec list_ghost_assoc (#key #value: Type) (k: key) (m: list (key & value))
: GTot (option value) (decreases m) =
| match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m' | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_avx_support | val va_quick_Check_avx_support: Prims.unit -> (va_quickCode unit (va_code_Check_avx_support ())) | val va_quick_Check_avx_support: Prims.unit -> (va_quickCode unit (va_code_Check_avx_support ())) | let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 158,
"start_col": 0,
"start_line": 155
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_avx_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_avx_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_avx_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_avx_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
| (va_QProc (va_code_Check_avx_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_avx_support
va_wpProof_Check_avx_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_aesni_support | val va_quick_Check_aesni_support: Prims.unit -> (va_quickCode unit (va_code_Check_aesni_support ())) | val va_quick_Check_aesni_support: Prims.unit -> (va_quickCode unit (va_code_Check_aesni_support ())) | let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 55,
"start_col": 0,
"start_line": 52
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_aesni_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_aesni_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_aesni_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_aesni_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
| (va_QProc (va_code_Check_aesni_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_aesni_support
va_wpProof_Check_aesni_support) | false |
CBOR.Pulse.fst | CBOR.Pulse.size_add | val size_add (x1 x2: SZ.t) (sq: squash (SZ.fits (SZ.v x1 + SZ.v x2))) : Tot SZ.t | val size_add (x1 x2: SZ.t) (sq: squash (SZ.fits (SZ.v x1 + SZ.v x2))) : Tot SZ.t | let size_add (x1 x2: SZ.t) (sq: squash (SZ.fits (SZ.v x1 + SZ.v x2))) : Tot SZ.t = x1 `SZ.add` x2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 97,
"end_line": 678,
"start_col": 0,
"start_line": 678
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m'
let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
)
let cbor_map_get_post_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(value: cbor)
: Tot vprop
= exists* vvalue.
raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue
)
let cbor_map_get_post
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
: Tot vprop
= match res with
| NotFound -> cbor_map_get_post_not_found p vkey vmap map
| Found value -> cbor_map_get_post_found p vkey vmap map value
let cbor_map_get_invariant
(pmap: perm)
(vkey: Ghost.erased Cbor.raw_data_item)
(vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop
= match res with
| Found value -> cbor_map_get_post_found pmap vkey vmap map value ** pure (
Cbor.Map? vmap /\
Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
)
| NotFound ->
cbor_map_iterator_match pmap i l **
(cbor_map_iterator_match pmap i l @==> raw_data_item_match pmap map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap) ==
list_ghost_assoc (Ghost.reveal vkey) l
)
```pulse
ghost
fn cbor_map_get_invariant_end
(pmap: perm)
(vkey: Ghost.erased Cbor.raw_data_item)
(vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(gres: Ghost.erased cbor_map_get_t)
(res: cbor_map_get_t)
(i: Ghost.erased cbor_map_iterator_t)
(l: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
requires
cbor_map_get_invariant pmap vkey vmap map gres i l **
pure (
(Nil? l \/ Found? gres) /\
res == Ghost.reveal gres
)
ensures
cbor_map_get_post pmap vkey vmap map res ** pure (
Cbor.Map? vmap /\
Found? res == Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
)
{
match res
{
NotFound ->
{
rewrite (cbor_map_get_invariant pmap vkey vmap map gres i l) // FIXME: WHY WHY WHY?
as (cbor_map_get_invariant pmap vkey vmap map NotFound i l);
unfold (cbor_map_get_invariant pmap vkey vmap map NotFound i l);
elim_stick0 ();
fold (cbor_map_get_post_not_found pmap vkey vmap map);
fold (cbor_map_get_post pmap vkey vmap map NotFound)
}
Found value ->
{
rewrite (cbor_map_get_invariant pmap vkey vmap map gres i l) // FIXME: WHY WHY WHY?
as (cbor_map_get_invariant pmap vkey vmap map (Found value) i l);
unfold (cbor_map_get_invariant pmap vkey vmap map (Found value) i l);
fold (cbor_map_get_post pmap vkey vmap map (Found value))
}
}
}
```
```pulse
fn cbor_map_get
(key: cbor)
(map: cbor)
(#pkey: perm)
(#pmap: perm)
(#vkey: Ghost.erased Cbor.raw_data_item)
(#vmap: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match pkey key vkey ** raw_data_item_match pmap map vmap ** pure (
Cbor.Map? vmap
))
returns res: cbor_map_get_t
ensures
(raw_data_item_match pkey key vkey ** cbor_map_get_post pmap vkey vmap map res ** pure (
Cbor.Map? vmap /\
Found? res == Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
))
{
let i0 = cbor_map_iterator_init map;
with l0 . assert (cbor_map_iterator_match pmap i0 l0);
let done0 = cbor_map_iterator_is_done i0;
let mut pi = i0;
let mut pres = NotFound;
let mut pdone = done0;
fold (cbor_map_get_invariant pmap vkey vmap map NotFound i0 l0);
while (
with gres i l . assert (pts_to pres gres ** pts_to pi i ** cbor_map_get_invariant pmap vkey vmap map gres i l);
let res = !pres;
let done = !pdone;
assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres i l); // FIXME: WHY WHY WHY?
not (done || Found? res)
)
invariant cont . exists* (done: bool) (res: cbor_map_get_t) (i: cbor_map_iterator_t) (l: list (Cbor.raw_data_item & Cbor.raw_data_item)) .
raw_data_item_match pkey key vkey **
pts_to pdone done **
pts_to pi i **
pts_to pres res **
cbor_map_get_invariant pmap vkey vmap map res i l **
pure (
done == Nil? l /\
cont == not (done || Found? res)
)
{
with gres gi l . assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres gi l);
rewrite each gres as NotFound;
unfold (cbor_map_get_invariant pmap vkey vmap map NotFound gi l);
let x = cbor_map_iterator_next pi;
stick_trans ();
with gi' l'. assert (cbor_map_iterator_match pmap gi' l');
with vx . assert (raw_data_item_map_entry_match pmap x vx);
rewrite_with_implies
(raw_data_item_map_entry_match pmap x vx)
(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx) **
raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx)
);
let test = cbor_is_equal key (cbor_map_entry_key x);
if (test) {
stick_consume_l ()
#(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx))
#(raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx));
stick_weaken_hyp_l
(raw_data_item_map_entry_match pmap x vx)
(cbor_map_iterator_match pmap gi' l');
stick_consume_r ()
#(raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx))
#(cbor_map_iterator_match pmap gi' l');
pres := Found (cbor_map_entry_value x);
fold (cbor_map_get_post_found pmap vkey vmap map (cbor_map_entry_value x));
fold (cbor_map_get_invariant pmap vkey vmap map (Found (cbor_map_entry_value x)) gi' l)
} else {
elim_stick0 ()
#(raw_data_item_match pmap (cbor_map_entry_key x) (fstp vx) ** raw_data_item_match pmap (cbor_map_entry_value x) (sndp vx));
stick_consume_l ()
#(raw_data_item_map_entry_match pmap x vx)
#(cbor_map_iterator_match pmap gi' l');
let i' = !pi;
rewrite each gi' as i';
let done = cbor_map_iterator_is_done i';
pdone := done;
fold (cbor_map_get_invariant pmap vkey vmap map NotFound i' l')
}
};
with gres i l . assert (pts_to pres gres ** cbor_map_get_invariant pmap vkey vmap map gres i l);
let res = !pres;
cbor_map_get_invariant_end pmap vkey vmap map gres res i l;
res
}
```
module SM = Pulse.Lib.SeqMatch
module AS = Pulse.Lib.ArraySwap
let cbor_map_sort_merge_invariant_prop
(lo: SZ.t)
(hi: SZ.t)
(l1_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(l2_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(cont: bool)
i1 i2 (res: bool) accu l1 l2
: Tot prop
=
SZ.v lo <= SZ.v i1 /\
SZ.v i1 <= SZ.v i2 /\
SZ.v i2 <= SZ.v hi /\
Cbor.map_sort_merge Cbor.cbor_compare [] l1_0 l2_0 == (
if res
then Cbor.map_sort_merge Cbor.cbor_compare accu l1 l2
else (false, accu `List.Tot.append` (l1 `List.Tot.append` l2))
) /\
cont == (res && not (i1 = i2 || i2 = hi))
let cbor_map_sort_merge_invariant // FIXME: WHY WHY WHY?
(a: A.array cbor_map_entry)
(lo: SZ.t)
(hi: SZ.t)
(l1_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(l2_0: Ghost.erased (list (Cbor.raw_data_item & Cbor.raw_data_item)))
(pi1: ref SZ.t)
(pi2: ref SZ.t)
(pres: ref bool)
(cont: bool)
i1 i2 (res: bool) c c1 c2 accu l1 l2
: Tot vprop
=
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pres res **
A.pts_to_range a (SZ.v lo) (SZ.v i1) c **
SM.seq_list_match c accu (raw_data_item_map_entry_match full_perm) **
A.pts_to_range a (SZ.v i1) (SZ.v i2) c1 **
SM.seq_list_match c1 l1 (raw_data_item_map_entry_match full_perm) **
A.pts_to_range a (SZ.v i2) (SZ.v hi) c2 **
SM.seq_list_match c2 l2 (raw_data_item_map_entry_match full_perm) **
pure (cbor_map_sort_merge_invariant_prop lo hi l1_0 l2_0 cont i1 i2 res accu l1 l2) | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.ArraySwap",
"short_module": "AS"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.SeqMatch",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
x1: FStar.SizeT.t ->
x2: FStar.SizeT.t ->
sq: Prims.squash (FStar.SizeT.fits (FStar.SizeT.v x1 + FStar.SizeT.v x2))
-> FStar.SizeT.t | Prims.Tot | [
"total"
] | [] | [
"FStar.SizeT.t",
"Prims.squash",
"FStar.SizeT.fits",
"Prims.op_Addition",
"FStar.SizeT.v",
"FStar.SizeT.add"
] | [] | false | false | false | false | false | let size_add (x1 x2: SZ.t) (sq: squash (SZ.fits (SZ.v x1 + SZ.v x2))) : Tot SZ.t =
| x1 `SZ.add` x2 | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_sha_support | val va_quick_Check_sha_support: Prims.unit -> (va_quickCode unit (va_code_Check_sha_support ())) | val va_quick_Check_sha_support: Prims.unit -> (va_quickCode unit (va_code_Check_sha_support ())) | let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 89,
"start_col": 0,
"start_line": 86
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_sha_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_sha_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_sha_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_sha_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
| (va_QProc (va_code_Check_sha_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_sha_support
va_wpProof_Check_sha_support) | false |
Vale.AES.PPC64LE.GHash.fst | Vale.AES.PPC64LE.GHash.va_lemma_Ghash_buffer_while0 | val va_lemma_Ghash_buffer_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) /\ va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM
(va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM
va_s0)))))))))))))))) | val va_lemma_Ghash_buffer_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) /\ va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM
(va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM
va_s0)))))))))))))))) | let va_lemma_Ghash_buffer_while0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_while0 va_mods va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_while0 ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(~(va_get_reg 6 va_sM >= 2))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index) | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 1786,
"start_col": 0,
"start_line": 1727
} | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
//-- MulAdd_unroll_1way
val va_code_MulAdd_unroll_1way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_1way () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons
(va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5))
(va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_CNil ())))))))
val va_codegen_success_MulAdd_unroll_1way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_1way () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
7)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_1way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_i:poly) = pdata 0 in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 136 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (fun (va_s:va_state) _ -> let
(va_arg44:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 138 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg44 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 139 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg43:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 140 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg43) (let
(va_arg42:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 141 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg42 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 142 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 143 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg41:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg40:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg40 va_arg41) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 145 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 146 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 147 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg37 va_arg38) (let
(va_arg36:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 148 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg36 64) (let
(va_arg35:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg35 64) (let
(va_arg34:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 150 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg34) (let
(va_arg33:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 151 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg33 64) (let
(va_arg32:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg32 64) (let
(va_arg31:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg30:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 153 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg30 va_arg31) (va_QEmpty
(()))))))))))))))))))))
val va_lemma_MulAdd_unroll_1way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_1way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) /\ va_state_eq va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_1way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_1way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_1way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 133 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 1 /\
in_b_blocks in_b index 1 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) . let va_sM = va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 va_s0))) in va_get_ok
va_sM /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 1 0) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_1way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_1way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_1way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_1way (va_code_MulAdd_unroll_1way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_1way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_1way ())) =
(va_QProc (va_code_MulAdd_unroll_1way ()) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
0]) (va_wp_MulAdd_unroll_1way in_b index h prev data) (va_wpProof_MulAdd_unroll_1way in_b index
h prev data))
//--
//-- MulAdd_unroll_2way
val va_code_MulAdd_unroll_2way : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_MulAdd_unroll_2way () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
8) (va_op_vec_opr_vec 6)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec
10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_CCons (va_code_VPolyMulHigh
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_CCons
(va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11)) (va_CNil
())))))))))))))))
val va_codegen_success_MulAdd_unroll_2way : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_MulAdd_unroll_2way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14)) (va_pbool_and (va_codegen_success_VPolyMul
(va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 13)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
11)) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_MulAdd_unroll_2way (va_mods:va_mods_t) (in_b:buffer128) (index:nat) (h:poly)
(prev:poly) (data:(seq quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (pdata:(Prims.int
-> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let
(data_0:poly) = pdata 0 in let (data_1:poly) = pdata 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0)
(va_op_reg_opr_reg 7) Secret in_b index) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 8)
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10) Secret in_b (index + 1)) (fun (va_s:va_state) _ ->
let (va_arg95:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg95 1) (let
(va_arg94:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg94) (let
(va_arg93:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg93 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 204 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg92:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg91:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 205 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg91 va_arg92) (let
(va_arg90:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 206 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg90 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 207 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg89:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg88:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 208 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg88 va_arg89) (let
(va_arg87:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 209 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg87 64) (let
(va_arg86:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 210 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg86 64) (let
(va_arg85:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 211 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg85) (let
(va_arg84:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 212 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg84 64) (let
(va_arg83:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 213 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg83 64) (let
(va_arg82:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg81:Vale.Math.Poly2_s.poly) = data_1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 214 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg81 va_arg82) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 215 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 0) (let (va_arg80:Vale.Math.Poly2_s.poly)
= h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 218 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power va_arg80 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun
(va_s:va_state) _ -> let (va_arg79:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 220 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg79) (let
(va_arg78:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 221 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg78 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 222 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 223 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 12)) (fun
(va_s:va_state) _ -> let (va_arg77:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg76:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
2) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 224 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg76 va_arg77) (let
(va_arg75:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 225 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg75 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 226 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 13))
(fun (va_s:va_state) _ -> let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64
in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 227 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg73 va_arg74) (let
(va_arg72:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg72 64) (let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg71 64) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 230 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 232 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg68 64) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.shift (add prev
data_0) (-64)) (Vale.Math.Poly2.mask (Vale.AES.GHash_BE.gf128_power h 2) 64) in let
(va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2.mask (add prev
data_0) 64) (Vale.Math.Poly2_s.shift (Vale.AES.GHash_BE.gf128_power h 2) (-64)) in let
(va_arg65:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 3 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 233 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate va_arg65 va_arg66 va_arg67) (let
(va_arg64:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 2 in let
(va_arg63:Vale.Math.Poly2_s.poly) = add prev data_0 in let (va_arg62:Vale.Math.Poly2_s.poly) =
of_quad32 (va_get_vec 4 va_s) in let (va_arg61:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec
3 va_s) in let (va_arg60:Vale.Math.Poly2_s.poly) = of_quad32 (va_get_vec 2 va_s) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 236 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128_accum va_arg60 va_arg61 va_arg62 va_arg63
va_arg64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 238 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 239 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 11))
(va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))
val va_lemma_MulAdd_unroll_2way : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> index:nat ->
h:poly -> prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_unroll_2way ()) va_s0 /\ va_get_ok va_s0 /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3
va_sM)) 64)) (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM))
128) == Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_MulAdd_unroll_2way va_b0 va_s0 in_b index h prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_MulAdd_unroll_2way va_mods in_b index h prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_MulAdd_unroll_2way ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in label va_range1
"***** POSTCONDITION NOT MET AT line 192 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in FStar.Seq.Base.length #quad32 data == 2 /\
in_b_blocks in_b index 2 (va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg 7
va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = va_upd_vec
11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4
va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0)))))))) in va_get_ok va_sM /\ (let (pdata:(Prims.int ->
Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_sM)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_sM)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 2 1) ==> va_k va_sM (())))
val va_wpProof_MulAdd_unroll_2way : in_b:buffer128 -> index:nat -> h:poly -> prev:poly -> data:(seq
quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_unroll_2way in_b index h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_MulAdd_unroll_2way in_b index h prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MulAdd_unroll_2way (va_code_MulAdd_unroll_2way ()) va_s0 in_b index
h prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_unroll_2way (in_b:buffer128) (index:nat) (h:poly) (prev:poly) (data:(seq
quad32)) : (va_quickCode unit (va_code_MulAdd_unroll_2way ())) =
(va_QProc (va_code_MulAdd_unroll_2way ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_MulAdd_unroll_2way in_b index h prev data) (va_wpProof_MulAdd_unroll_2way in_b index h
prev data))
//--
//-- Reduce
val va_code_Reduce : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Reduce () =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Low64ToHigh
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 10)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
2) (va_op_vec_opr_vec 8)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 10)) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2))
(va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
4)) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
2)) (va_CNil ()))))))))))))))
val va_codegen_success_Reduce : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Reduce () =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3)) (va_pbool_and
(va_codegen_success_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9))
(va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyAdd
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_pbool_and
(va_codegen_success_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and
(va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
8)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Reduce (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 265 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 266 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a1 64) (let
(va_arg39:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.mask a1 64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_is_mul va_arg39 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 268 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg38:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a1 64) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg38) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 271 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 272 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div a1 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 274 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) a1) (fun (va_s:va_state) _ ->
let (va_arg37:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift a1 (-64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg37) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 276 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (fun
(va_s:va_state) _ -> let (va_arg36:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 10 va_s) in let (va_arg35:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 277 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg35 va_arg36) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 10)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 282 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> let (va_arg34:Vale.Math.Poly2_s.poly) = f in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 283 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_reduce_rev a0 a1 a2 va_arg34 64) (va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Reduce : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Reduce ()) va_s0 /\ va_get_ok va_s0 /\ (let
(g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in let
(c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in
let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) /\ va_state_eq va_sM
(va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 9 va_sM
(va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM (va_update_vec 0 va_sM
(va_update_ok va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_Reduce va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_Reduce va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Reduce ()) va_qc va_s0 (fun va_s0 va_sM
va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 242 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f
in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1))
63 in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)
in let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in
let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in label va_range1
"***** POSTCONDITION NOT MET AT line 263 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) == Vale.Math.Poly2_s.reverse (mod
(Vale.Math.Poly2_s.reverse a 255) g) 127))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Reduce (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (g:Vale.Math.Poly2_s.poly) = add (Vale.Math.Poly2_s.monomial 128) f in
let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63
in let (a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in
let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) (-64) == zero /\ Vale.Math.Poly2.mask (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 8 va_s0)) 64 == c /\ Vale.Math.Poly2_s.degree f < 64 /\ Vale.Math.Poly2_s.degree g
== 128 /\ Vale.Math.Poly2_s.poly_index f 0) /\ (forall (va_x_v0:quad32) (va_x_v10:quad32)
(va_x_v8:quad32) (va_x_v2:quad32) (va_x_v9:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v1:quad32) . let va_sM = va_upd_vec 1 va_x_v1 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3
(va_upd_vec 9 va_x_v9 (va_upd_vec 2 va_x_v2 (va_upd_vec 8 va_x_v8 (va_upd_vec 10 va_x_v10
(va_upd_vec 0 va_x_v0 va_s0))))))) in va_get_ok va_sM /\ (let (g:Vale.Math.Poly2_s.poly) = add
(Vale.Math.Poly2_s.monomial 128) f in let (c:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift f (-1)) 63 in let
(a0:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0) in let
(a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0) in let
(a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0) in let
(a:Vale.Math.Poly2_s.poly) = add (add a0 (Vale.Math.Poly2_s.shift a1 64))
(Vale.Math.Poly2_s.shift a2 128) in Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) ==
Vale.Math.Poly2_s.reverse (mod (Vale.Math.Poly2_s.reverse a 255) g) 127) ==> va_k va_sM (())))
val va_wpProof_Reduce : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Reduce f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Reduce f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Reduce (va_code_Reduce ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 1 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 9 va_sM (va_update_vec 2 va_sM (va_update_vec 8 va_sM (va_update_vec 10 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9; va_Mod_vec 2;
va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Reduce (f:poly) : (va_quickCode unit (va_code_Reduce ())) =
(va_QProc (va_code_Reduce ()) ([va_Mod_vec 1; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 9;
va_Mod_vec 2; va_Mod_vec 8; va_Mod_vec 10; va_Mod_vec 0]) (va_wp_Reduce f) (va_wpProof_Reduce
f))
//--
//-- ReduceLast
[@ "opaque_to_smt" va_qattr]
let va_code_ReduceLast () =
(va_Block (va_CCons (va_code_Reduce ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ReduceLast () =
(va_pbool_and (va_codegen_success_Reduce ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ReduceLast (va_mods:va_mods_t) (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 311 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_constant_shift_rev ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 312 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 313 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Reduce gf128_modulus_low_terms) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg25:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 314 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_unroll_back_forward h prev pdata 0 va_arg25)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(n - 1 >= 0) (fun _ -> let (va_arg24:Prims.nat) = n - 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 315 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_poly_of_unroll h prev pdata 0 va_arg24) (let
(va_arg23:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let
(va_arg22:Vale.Def.Types_s.quad32) = y_prev in let (va_arg21:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 316 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental_poly va_arg21 va_arg22 va_arg23)
(let (va_arg20:Vale.Def.Types_s.quad32) = Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 317 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_to_of_quad32 va_arg20) (va_QEmpty (()))))))))))))
[@"opaque_to_smt"]
let va_lemma_ReduceLast va_b0 va_s0 h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in
let va_qc = va_qcode_ReduceLast va_mods h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceLast ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 307 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 308 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 309 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_ReduceLast h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ReduceLast (va_code_ReduceLast ()) va_s0 h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- GhashUnroll_n
[@ "opaque_to_smt" va_qattr]
let va_code_GhashUnroll_n exactly2 =
(va_Block (va_CCons (if exactly2 then va_Block (va_CCons (va_code_MulAdd_unroll_2way ()) (va_CNil
())) else va_Block (va_CCons (va_code_MulAdd_unroll_1way ()) (va_CNil ()))) (va_CCons
(va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg
10) (-15872)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4)
(va_CCons (va_code_ReduceLast ()) (va_CNil ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_GhashUnroll_n exactly2 =
(va_pbool_and (if exactly2 then va_pbool_and (va_codegen_success_MulAdd_unroll_2way ()) (va_ttrue
()) else va_pbool_and (va_codegen_success_MulAdd_unroll_1way ()) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0) (va_pbool_and
(va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_GhashUnroll_n (va_mods:va_mods_t) (exactly2:bool) (in_b:buffer128) (index:nat)
(h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n
exactly2)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 361 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qInlineIf va_mods exactly2 (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 363 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_2way in_b index h prev data) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 367 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_MulAdd_unroll_1way in_b index h prev data) (va_QEmpty (()))))) (fun (va_s:va_state)
va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 369 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 370 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg27:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 371 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg27 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 372 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 373 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 374 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 375 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_GhashUnroll_n va_b0 va_s0 exactly2 in_b index h_BE y_prev data =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_GhashUnroll_n va_mods exactly2 in_b index h_BE y_prev data in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_GhashUnroll_n exactly2) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in label va_range1
"***** POSTCONDITION NOT MET AT line 359 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0 va_k =
let (va_sM, va_f0) = va_lemma_GhashUnroll_n (va_code_GhashUnroll_n exactly2) va_s0 exactly2 in_b
index h_BE y_prev data in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_register
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_register () =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5))
(va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5)) (va_CCons
(va_code_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5)) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec
9)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 7)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 5)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
9) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 0) (va_CCons
(va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_ReduceLast ()) (va_CNil
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_register () =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 5) Secret) (va_pbool_and (va_codegen_success_Vspltisw
(va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 7)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_VPolyMulLow
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7)) (va_pbool_and
(va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 0)
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (va_pbool_and
(va_codegen_success_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_ReduceLast ()) (va_ttrue
()))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_register (va_mods:va_mods_t) (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_register ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 405 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 5) Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 406 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 407 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VSwap (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)) (fun (va_s:va_state) _ -> let
(va_arg71:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 408 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg71) (let
(va_arg70:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 409 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg70) (let
(va_arg69:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 410 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg69) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 411 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_High64ToLow (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 412 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Low64ToHigh (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 5) (Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64)) (fun (va_s:va_state) _ -> let
(va_arg68:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg68) (let
(va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg67) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(0 >= 0 /\ (fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let
(i_515:Prims.nat) = i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539
s_540))) quad32 data 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 9 va_s == FStar.Seq.Base.index #quad32 data 0) (let (data_i:poly) = pdata 0 in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 419 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_gf128_power h 1) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 420 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyAdd (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9)) (fun
(va_s:va_state) _ -> let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s)) (Vale.Math.Poly2_s.monomial 64) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 421 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg66) (let
(va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 422 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg65 64) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 423 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 7))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 5)) (fun
(va_s:va_state) _ -> let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h
1) (Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 425 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg63 va_arg64) (let
(va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 426 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg62 64) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 427 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_VPolyMulHigh (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 6)) (fun
(va_s:va_state) _ -> let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in
let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 428 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg60 va_arg61) (let
(va_arg59:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 429 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg59 64) (let
(va_arg58:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 430 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg58 64) (let
(va_arg57:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 431 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_swap128_mask_shift va_arg57) (let
(va_arg56:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 432 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg56 64) (let
(va_arg55:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 433 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg55 64) (let
(va_arg54:Vale.Math.Poly2_s.poly) = Vale.AES.GHash_BE.gf128_power h 1 in let
(va_arg53:Vale.Math.Poly2_s.poly) = add prev data_i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 434 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_Mul128 va_arg53 va_arg54) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 436 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 8) 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 437 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) (-15872)) (fun (va_s:va_state) _ -> let
(va_arg52:Vale.Def.Types_s.nat64) = (-15872) `op_Modulus` pow2_64 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 438 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg52 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 0) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 8) 4) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 442 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_ReduceLast h_BE y_prev data) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_register va_b0 va_s0 hkeys_b h_BE y_prev =
let (va_mods:va_mods_t) = [va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok] in
let va_qc = va_qcode_Ghash_register va_mods hkeys_b h_BE y_prev in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_register ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 378 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Ghash_register hkeys_b h_BE y_prev va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_register (va_code_Ghash_register ()) va_s0 hkeys_b h_BE
y_prev in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;
va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Ghash_buffer_loop_body
val va_code_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_loop_body () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_GhashUnroll_n true) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil
())) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_CCons
(va_code_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_CNil ())))))))))
val va_codegen_success_Ghash_buffer_loop_body : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_loop_body () =
(va_pbool_and (va_codegen_success_GhashUnroll_n true) (va_pbool_and (va_codegen_success_AddImm
(va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_pbool_and (va_codegen_success_SubImm
(va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_loop_body (va_mods:va_mods_t) (in_b:buffer128) (h_BE:quad32)
(y_prev:quad32) (old_len:nat64) (index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 501 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) index (index + 2)) (fun _ -> let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) index (index + 2) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 502 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_GhashUnroll_n true in_b index h_BE (Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index)) data) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index) (fun _ -> let (va_arg27:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index in let (va_arg26:Vale.Def.Types_s.quad32) = va_get_vec 1 va_s in let
(va_arg25:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg24:Vale.Def.Types_s.quad32) = y_prev in let (va_arg23:Vale.Def.Types_s.quad32) = h_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 503 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(fun (_:unit) -> Vale.AES.GHash_BE.lemma_ghash_incremental0_append va_arg23 va_arg24 va_arg25
va_arg26 va_arg27 data) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s) in_b)) 0 index /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906))
(i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t
(Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869
(FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 (index + 2)) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 505 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(FStar.Seq.Base.equal #Vale.Def.Types_s.quad32 (FStar.Seq.Base.append #Vale.Def.Types_s.quad32
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 index) data)
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) 0 (index + 2))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 507 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) 32) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 508 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_SubImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 2) (va_QEmpty (()))))))))))))
val va_lemma_Ghash_buffer_loop_body : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 ->
h_BE:quad32 -> y_prev:quad32 -> old_len:nat64 -> index:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_loop_body ()) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6 va_s0
>= 2 /\ index + va_get_reg 6 va_s0 == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b index (va_get_reg 6 va_s0)
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_s0 + 16 `op_Multiply`
va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) 0 index) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index +
2 in index' + va_get_reg 6 va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM)
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7 va_sM + 16 `op_Multiply`
va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) 0 index') /\ va_get_reg 7 va_sM ==
va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_loop_body va_b0 va_s0 in_b h_BE y_prev old_len index =
let (va_mods:va_mods_t) = [va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec
4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6;
va_Mod_reg 7; va_Mod_ok] in
let va_qc = va_qcode_Ghash_buffer_loop_body va_mods in_b h_BE y_prev old_len index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_loop_body ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 445 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in label va_range1
"***** POSTCONDITION NOT MET AT line 487 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(let index' = index + 2 in label va_range1
"***** POSTCONDITION NOT MET AT line 489 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index' + va_get_reg 6 va_sM == old_len) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 492 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 493 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 494 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 495 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) in_b)) 0 index')) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 - 2)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in va_get_reg 6
va_s0 >= 2 /\ index + va_get_reg 6 va_s0 == old_len /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
in_b index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in_b)) 0 index) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64)) /\ (forall (va_x_r7:nat64)
(va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6
(va_upd_reg 7 va_x_r7 va_s0))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let index' = index + 2 in index' + va_get_reg 6
va_sM == old_len /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM) in_b index' (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == old_len /\ va_get_reg 7
va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM)
in_b)) 0 index') /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 32 /\ va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 - 2) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer_loop_body : in_b:buffer128 -> h_BE:quad32 -> y_prev:quad32 ->
old_len:nat64 -> index:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_loop_body ())
([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 7]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Ghash_buffer_loop_body (va_code_Ghash_buffer_loop_body ()) va_s0
in_b h_BE y_prev old_len index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM
(va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 6 va_sM
(va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg
7]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_loop_body (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) (old_len:nat64)
(index:nat) : (va_quickCode unit (va_code_Ghash_buffer_loop_body ())) =
(va_QProc (va_code_Ghash_buffer_loop_body ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10; va_Mod_reg 6; va_Mod_reg 7]) (va_wp_Ghash_buffer_loop_body in_b h_BE y_prev old_len index)
(va_wpProof_Ghash_buffer_loop_body in_b h_BE y_prev old_len index))
//--
//-- Mod_cr0
val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Mod_cr0 () =
(va_Block (va_CNil ()))
val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Mod_cr0 () =
(va_ttrue ())
[@ "opaque_to_smt" va_qattr]
let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (())))
val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mod_cr0 ()) 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 /\
va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Mod_cr0 va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in
let va_qc = va_qcode_Mod_cr0 va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok
va_sM ==> va_k va_sM (())))
val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Mod_cr0 va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) =
(va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0)
//--
//-- Ghash_buffer_body0
val va_code_Ghash_buffer_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_body0 () =
(va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Ghash_buffer_loop_body ()) (va_CNil
()))))
val va_codegen_success_Ghash_buffer_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_body0 () =
(va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and
(va_codegen_success_Ghash_buffer_loop_body ()) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_body0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 595 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Mod_cr0 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 596 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_loop_body in_b h_BE y_prev (va_get_reg 6 va_old) index) (fun
(va_s:va_state) _ -> let (index:nat) = index + 2 in va_QEmpty ((index))))))
val va_lemma_Ghash_buffer_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_body0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) /\ va_state_eq va_sM (va_update_vec 9
va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM
(va_update_cr0 va_sM va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Ghash_buffer_body0 va_b0 va_s0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0] in
let va_qc = va_qcode_Ghash_buffer_body0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev
va_in_index in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Ghash_buffer_body0 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let index = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let index = va_g in
(va_sM, va_fM, index)
[@ va_qattr]
let va_wp_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) (va_s0:va_state) (va_k:(va_state
-> nat -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0
== va_get_reg 7 va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s0) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE /\ va_get_reg 6 va_s0 >= 2 /\ (forall (va_x_cr0:cr0_t) (va_x_ok:bool)
(va_x_r10:nat64) (va_x_r6:nat64) (va_x_r7:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v8:quad32) (va_x_v9:quad32) (index:nat) . let va_sM = va_upd_vec 9 va_x_v9 (va_upd_vec 8
va_x_v8 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 11
va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 7
va_x_r7 (va_upd_reg 6 va_x_r6 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_cr0 va_x_cr0
va_s0))))))))))))) in va_get_ok va_sM /\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\
va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
1) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
precedes_wrap (va_get_reg 6 va_sM) (va_get_reg 6 va_s0) ==> va_k va_sM ((index))))
val va_wpProof_Ghash_buffer_body0 : va_old:va_state -> va_in_h:poly -> va_in_h_BE:quad32 ->
va_in_in_b:buffer128 -> va_in_y_prev:quad32 -> va_in_index:nat -> va_s0:va_state ->
va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b
va_in_y_prev va_in_index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Ghash_buffer_body0 va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
va_s0 va_k =
let (va_sM, va_f0, index) = va_lemma_Ghash_buffer_body0 (va_code_Ghash_buffer_body0 ()) va_s0
va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM
(va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6;
va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) va_sM va_s0;
let va_g = (index) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer_body0 (va_old:va_state) (va_in_h:poly) (va_in_h_BE:quad32)
(va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) : (va_quickCode nat
(va_code_Ghash_buffer_body0 ())) =
(va_QProc (va_code_Ghash_buffer_body0 ()) ([va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7;
va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok; va_Mod_cr0]) (va_wp_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index) (va_wpProof_Ghash_buffer_body0 va_old va_in_h
va_in_h_BE va_in_in_b va_in_y_prev va_in_index))
//--
//-- Ghash_buffer_while0
val va_code_Ghash_buffer_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Ghash_buffer_while0 () =
(va_Block (va_CCons (va_While (va_cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (va_Block (va_CCons
(va_code_Ghash_buffer_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Ghash_buffer_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Ghash_buffer_while0 () =
(va_pbool_and (va_codegen_success_Ghash_buffer_body0 ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Ghash_buffer_while0 (va_mods:va_mods_t) (va_old:va_state) (va_in_h:poly)
(va_in_h_BE:quad32) (va_in_in_b:buffer128) (va_in_y_prev:quad32) (va_in_index:nat) :
(va_quickCode (nat) (va_code_Ghash_buffer_while0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:poly) = va_in_h
in let (h_BE:quad32) = va_in_h_BE in let (in_b:buffer128) = va_in_in_b in let (y_prev:quad32) =
va_in_y_prev in let (index:nat) = va_in_index in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_qWhile va_mods (Cmp_ge (va_op_cmp_reg 6) (va_const_cmp 2)) (fun va_g -> let (index:nat) =
let index = va_g in index in qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_quick_Ghash_buffer_body0 va_old h h_BE in_b y_prev index) (fun (va_s:va_state) (index:nat)
-> va_QEmpty ((index))))) (fun (va_s:va_state) va_g -> let (index:nat) = let index = va_g in
index in va_get_ok va_s /\ index + va_get_reg 6 va_s == va_get_reg 6 va_old /\ va_get_reg 7
va_s == va_get_reg 7 va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 5 va_s) == Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s)
== Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) in_b
index (va_get_reg 6 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_old /\ va_get_reg 7 va_s + 16
`op_Multiply` va_get_reg 6 va_s < pow2_64 /\ va_get_vec 1 va_s ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s)
in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_s == va_get_vec 1 va_old) /\ h
== Vale.Math.Poly2.Bits_s.of_quad32 h_BE) (fun (va_s:va_state) va_g -> let (index:nat) = let
index = va_g in index in va_get_reg 6 va_s) ((index))) (fun (va_s:va_state) va_g -> let
(index:nat) = let index = va_g in index in let va_g = (index) in let (index:nat) = va_g in
va_QEmpty ((index)))))
val va_lemma_Ghash_buffer_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_h:poly -> va_in_h_BE:quad32 -> va_in_in_b:buffer128 -> va_in_y_prev:quad32 ->
va_in_index:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Ghash_buffer_while0 ()) va_s0 /\ va_get_ok va_s0 /\
va_in_index + va_get_reg 6 va_s0 == va_get_reg 6 va_old /\ va_get_reg 7 va_s0 == va_get_reg 7
va_old + 16 `op_Multiply` va_in_index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0)
== Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0)
va_in_in_b va_in_index (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1
va_s0 == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_s0) va_in_in_b)) 0 va_in_index) /\ (va_get_reg 6 va_old == 0 ==>
va_get_vec 1 va_s0 == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32
va_in_h_BE))
(ensures (fun (va_sM, va_fM, index) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ index + va_get_reg 6 va_sM == va_get_reg 6 va_old /\ va_get_reg 7 va_sM == va_get_reg 7
va_old + 16 `op_Multiply` index /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) == Vale.Math.Poly2_s.mul
(Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64)) (Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM)
== Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1) (Vale.Math.Poly2_s.monomial
64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power va_in_h 2) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13
va_sM) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h
2) (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) == Vale.Math.Poly2_s.mod
(Vale.AES.GHash_BE.gf128_power va_in_h 2) (Vale.Math.Poly2_s.monomial 64) /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM)
va_in_in_b index (va_get_reg 6 va_sM) (va_get_mem_layout va_sM) Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == va_get_reg 6
va_old /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 6 va_sM < pow2_64 /\ va_get_vec 1
va_sM == Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE va_in_y_prev (FStar.Seq.Base.slice
#Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128
(va_get_mem_heaplet 1 va_sM) va_in_in_b)) 0 index) /\ (va_get_reg 6 va_old == 0 ==> va_get_vec
1 va_sM == va_get_vec 1 va_old) /\ va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE /\
~(va_get_reg 6 va_sM >= 2) /\ va_state_eq va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 7 va_sM
(va_update_reg 6 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_cr0 va_sM
va_s0)))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.Types_helpers.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.GHash.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_old: Vale.PPC64LE.Decls.va_state ->
va_in_h: Vale.Math.Poly2_s.poly ->
va_in_h_BE: Vale.PPC64LE.Memory.quad32 ->
va_in_in_b: Vale.PPC64LE.Memory.buffer128 ->
va_in_y_prev: Vale.PPC64LE.Memory.quad32 ->
va_in_index: Prims.nat
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.nat) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.PPC64LE.QuickCodes.fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Vale.PPC64LE.QuickCode.va_Mod_cr0",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer_while0",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.PPC64LE.QuickCodes.label",
"Vale.PPC64LE.QuickCodes.va_range1",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.int",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Multiply",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.Math.Poly2.swap",
"Vale.AES.GHash_BE.gf128_power",
"Vale.Math.Poly2_s.mul",
"Vale.Math.Poly2_s.div",
"Vale.Math.Poly2_s.monomial",
"Vale.Math.Poly2_s.mod",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.buffer_length",
"Vale.PPC64LE.Memory.vuint128",
"Prims.op_LessThan",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash_BE.ghash_incremental0",
"FStar.Seq.Base.slice",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"Vale.PPC64LE.Decls.s128",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.quad32",
"Prims.l_not",
"Prims.op_GreaterThanOrEqual",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.AES.PPC64LE.GHash.va_qcode_Ghash_buffer_while0",
"Vale.PPC64LE.Decls.va_expand_state"
] | [] | false | false | false | false | false | let va_lemma_Ghash_buffer_while0
va_b0
va_s0
va_old
va_in_h
va_in_h_BE
va_in_in_b
va_in_y_prev
va_in_index
=
| let va_old = va_expand_state va_old in
let va_mods:va_mods_t =
[
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10; va_Mod_ok;
va_Mod_cr0
]
in
let va_qc =
va_qcode_Ghash_buffer_while0 va_mods va_old va_in_h va_in_h_BE va_in_in_b va_in_y_prev va_in_index
in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Ghash_buffer_while0 ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let index = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(index + va_get_reg 6 va_sM == va_get_reg 6 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` index) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 579 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 1) 64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 580 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_sM) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 1)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 581 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_sM) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 1)
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 582 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_sM) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power va_in_h 2) 64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 583 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_sM) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power va_in_h 2)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 584 column 69 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_sM) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power va_in_h 2)
(Vale.Math.Poly2_s.monomial 64)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 585 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 7 va_sM)
va_in_in_b
index
(va_get_reg 6 va_sM)
(va_get_mem_layout va_sM)
Secret) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 586 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b ==
va_get_reg 6 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 587 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM) < pow2_64) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 va_in_h_BE
va_in_y_prev
(FStar.Seq.Base.slice #Vale.Def.Types_s.quad32
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet
1
va_sM)
va_in_in_b))
0
index)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 589 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_get_reg 6 va_old == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_old) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 590 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(va_in_h == Vale.Math.Poly2.Bits_s.of_quad32 va_in_h_BE) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 517 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****"
(~(va_get_reg 6 va_sM >= 2)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 7; va_Mod_reg 6; va_Mod_reg 10;
va_Mod_ok; va_Mod_cr0
])
va_sM
va_s0;
let index = va_g in
(va_sM, va_fM, index) | false |
CBOR.Pulse.fst | CBOR.Pulse.cbor_map_get_post | val cbor_map_get_post (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) (res: cbor_map_get_t)
: Tot vprop | val cbor_map_get_post (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) (res: cbor_map_get_t)
: Tot vprop | let cbor_map_get_post
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
: Tot vprop
= match res with
| NotFound -> cbor_map_get_post_not_found p vkey vmap map
| Found value -> cbor_map_get_post_found p vkey vmap map value | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 64,
"end_line": 473,
"start_col": 0,
"start_line": 464
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m'
let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
)
let cbor_map_get_post_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(value: cbor)
: Tot vprop
= exists* vvalue.
raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue
) | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: PulseCore.FractionalPermission.perm ->
vkey: CBOR.Spec.Type.raw_data_item ->
vmap: CBOR.Spec.Type.raw_data_item ->
map: CBOR.Pulse.Type.cbor ->
res: CBOR.Pulse.cbor_map_get_t
-> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"PulseCore.FractionalPermission.perm",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Pulse.Type.cbor",
"CBOR.Pulse.cbor_map_get_t",
"CBOR.Pulse.cbor_map_get_post_not_found",
"CBOR.Pulse.cbor_map_get_post_found",
"Pulse.Lib.Core.vprop"
] | [] | false | false | false | true | false | let cbor_map_get_post (p: perm) (vkey vmap: Cbor.raw_data_item) (map: cbor) (res: cbor_map_get_t)
: Tot vprop =
| match res with
| NotFound -> cbor_map_get_post_not_found p vkey vmap map
| Found value -> cbor_map_get_post_found p vkey vmap map value | false |
CBOR.Pulse.fst | CBOR.Pulse.cbor_map_get_invariant | val cbor_map_get_invariant
(pmap: perm)
(vkey vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop | val cbor_map_get_invariant
(pmap: perm)
(vkey vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop | let cbor_map_get_invariant
(pmap: perm)
(vkey: Ghost.erased Cbor.raw_data_item)
(vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop
= match res with
| Found value -> cbor_map_get_post_found pmap vkey vmap map value ** pure (
Cbor.Map? vmap /\
Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))
)
| NotFound ->
cbor_map_iterator_match pmap i l **
(cbor_map_iterator_match pmap i l @==> raw_data_item_match pmap map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap) ==
list_ghost_assoc (Ghost.reveal vkey) l
) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Pulse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 496,
"start_col": 0,
"start_line": 475
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Pulse
include CBOR.Spec.Constants
include CBOR.Pulse.Extern
open Pulse.Lib.Pervasives
open Pulse.Lib.Stick
module Cbor = CBOR.Spec
module A = Pulse.Lib.Array
module SZ = FStar.SizeT
#push-options "--fuel 2 --ifuel 2"
assume val elim_stick0
(_: unit)
(#hyp #concl: vprop)
: stt_ghost unit
((hyp @==> concl) ** hyp)
(fun _ -> concl)
assume val stick_refl0
(p: vprop)
: stt_ghost unit
(emp)
(fun _ -> p @==> p)
assume
val stick_consume_l
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
(p ** ((p ** q) @==> r))
(fun _ -> q @==> r)
assume
val stick_consume_r
(_: unit)
(#q #p #r: vprop)
: stt_ghost unit
(p ** ((q ** p) @==> r))
(fun _ -> q @==> r)
assume
val stick_trans
(_: unit)
(#p #q #r: vprop)
: stt_ghost unit
((p @==> q) ** (q @==> r))
(fun _ -> p @==> r)
assume
val rewrite_with_implies
(p q: vprop)
: stt_ghost unit
(p ** pure (p == q))
(fun _ -> q ** (q @==> p))
assume
val stick_weaken_hyp_r
(hl hr #hr' #c: vprop)
: stt_ghost unit
((hr' @==> hr) ** ((hl ** hr) @==> c))
(fun _ -> (hl ** hr') @==> c)
assume
val stick_weaken_hyp_l
(hl hr #hl' #c: vprop)
: stt_ghost unit
((hl' @==> hl) ** ((hl ** hr) @==> c))
(fun _ -> (hl' ** hr) @==> c)
assume Fits_u64 : squash (SZ.fits_u64)
module U8 = FStar.UInt8
module U64 = FStar.UInt64
module I16 = FStar.Int16
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u8
(x1 x2: U8.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U8.lt` x2
then -1s
else 1s
let impl_compare_u8_correct
(x1 x2: U8.t)
: Lemma
(I16.v (impl_compare_u8 x1 x2) == Cbor.int_compare (U8.v x1) (U8.v x2))
[SMTPat (impl_compare_u8 x1 x2)]
= ()
inline_for_extraction noextract [@@noextract_to "krml"]
let impl_compare_u64
(x1 x2: U64.t)
: Tot I16.t
= if x1 = x2
then 0s
else if x1 `U64.lt` x2
then -1s
else 1s
let impl_compare_u64_correct
(x1 x2: U64.t)
: Lemma
(I16.v (impl_compare_u64 x1 x2) == Cbor.int_compare (U64.v x1) (U64.v x2))
[SMTPat (impl_compare_u64 x1 x2)]
= ()
```pulse
fn byte_array_compare
(sz: SZ.t)
(a1: A.larray U8.t (SZ.v sz))
(a2: A.larray U8.t (SZ.v sz))
(#p1: perm)
(#p2: perm)
(#va1: Ghost.erased (Seq.seq U8.t))
(#va2: Ghost.erased (Seq.seq U8.t))
requires
(A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2)
returns res: I16.t
ensures
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pure (I16.v res == Cbor.bytes_lex_compare va1 va2)
{
A.pts_to_len a1;
A.pts_to_len a2;
let mut pi = 0sz;
let mut pres = 0s;
let prf1 : squash (Ghost.reveal va1 `Seq.equal` Seq.slice va1 0 (SZ.v sz)) = ();
let prf2 : squash (Ghost.reveal va2 `Seq.equal` Seq.slice va2 0 (SZ.v sz)) = ();
while (let i = !pi; let res = !pres; ((i `SZ.lt` sz) && (res = 0s)))
invariant cont . exists* i res .
A.pts_to a1 #p1 va1 ** A.pts_to a2 #p2 va2 **
pts_to pi i ** pts_to pres res **
pure (
SZ.v i <= SZ.v sz /\
Cbor.bytes_lex_compare va1 va2 == (
if res = 0s
then Cbor.bytes_lex_compare (Seq.slice va1 (SZ.v i) (SZ.v sz)) (Seq.slice va2 (SZ.v i) (SZ.v sz))
else I16.v res
) /\
(cont == (SZ.v i < SZ.v sz && res = 0s))
)
{
let i = !pi;
let x1 = a1.(i);
let x2 = a2.(i);
let res = impl_compare_u8 x1 x2;
pi := i `SZ.add` 1sz;
pres := res;
};
!pres
}
```
inline_for_extraction noextract [@@noextract_to "krml"]
let i16_neq_0 (x: I16.t) : Tot bool = x <> 0s // FIXME: WHY WHY WHY?
```pulse
fn rec cbor_compare
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: I16.t
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
((I16.v res <: int) == Cbor.cbor_compare v1 v2)
))
{
let test = cbor_compare_aux a1 a2;
if (test = -1s || test = 0s || test = 1s) {
test
} else {
let ty1 = cbor_get_major_type a1;
let ty2 = cbor_get_major_type a2;
let c = impl_compare_u8 ty1 ty2;
if (i16_neq_0 c)
{
c
} else if (ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64) {
let i1 = cbor_destr_int64 a1;
let i2 = cbor_destr_int64 a2;
(impl_compare_u64 i1.cbor_int_value i2.cbor_int_value)
} else if (ty1 = cbor_major_type_simple_value) {
let i1 = cbor_destr_simple_value a1;
let i2 = cbor_destr_simple_value a2;
(impl_compare_u8 i1 i2)
} else if (ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string) {
let s1 = cbor_destr_string a1;
let s2 = cbor_destr_string a2;
let c = impl_compare_u64 s1.cbor_string_length s2.cbor_string_length;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
A.pts_to_len s1.cbor_string_payload;
A.pts_to_len s2.cbor_string_payload;
let test = byte_array_compare (SZ.uint64_to_sizet s1.cbor_string_length) s1.cbor_string_payload s2.cbor_string_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_array) {
let len1 = cbor_array_length a1;
let len2 = cbor_array_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_array_iterator_init a1;
let i20 = cbor_array_iterator_init a2;
let done0 = cbor_array_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_array_iterator_match p1 i1 l1 **
cbor_array_iterator_match p2 i2 l2 **
(cbor_array_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_array_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_array l1 l2 else I16.v res) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_array_iterator_next pi1;
with v1' . assert (raw_data_item_match p1 x1 v1');
let x2 = cbor_array_iterator_next pi2;
with v2' . assert (raw_data_item_match p2 x2 v2');
let res = cbor_compare x1 x2;
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_array_iterator_match p1 gi1' l1');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_array_iterator_match p2 gi2' l2');
stick_consume_l ()
#(raw_data_item_match p1 x1 v1')
#(cbor_array_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_match p2 x2 v2')
#(cbor_array_iterator_match p2 gi2' l2');
stick_trans ()
#(cbor_array_iterator_match p1 gi1' l1');
stick_trans ()
#(cbor_array_iterator_match p2 gi2' l2');
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_array_iterator_is_done i1;
pdone := done
} else {
pres := res
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else if (ty1 = cbor_major_type_tagged) {
let tg1 = cbor_destr_tagged a1;
let tg2 = cbor_destr_tagged a2;
let c = impl_compare_u64 tg1.cbor_tagged_tag tg2.cbor_tagged_tag;
if (i16_neq_0 c) {
elim_stick0 ();
elim_stick0 ();
c
} else {
with v1' . assert (raw_data_item_match p1 tg1.cbor_tagged_payload v1');
with v2' . assert (raw_data_item_match p2 tg2.cbor_tagged_payload v2');
let test = cbor_compare tg1.cbor_tagged_payload tg2.cbor_tagged_payload;
elim_stick0 ();
elim_stick0 ();
test
}
} else if (ty1 = cbor_major_type_map) {
let len1 = cbor_map_length a1;
let len2 = cbor_map_length a2;
let c = impl_compare_u64 len1 len2;
if (i16_neq_0 c) {
c
} else {
let i10 = cbor_map_iterator_init a1;
let i20 = cbor_map_iterator_init a2;
let done0 = cbor_map_iterator_is_done i10;
let mut pi1 = i10;
let mut pi2 = i20;
let mut pdone = done0;
let mut pres = 0s;
while (
let done = !pdone;
let res = !pres;
(res = 0s && not done)
)
invariant cont . exists* i1 i2 done res l1 l2 .
pts_to pi1 i1 ** pts_to pi2 i2 ** pts_to pdone done ** pts_to pres res **
cbor_map_iterator_match p1 i1 l1 **
cbor_map_iterator_match p2 i2 l2 **
(cbor_map_iterator_match p1 i1 l1 @==> raw_data_item_match p1 a1 v1) **
(cbor_map_iterator_match p2 i2 l2 @==> raw_data_item_match p2 a2 v2) **
pure (
List.Tot.length l1 == List.Tot.length l2 /\
(Cbor.cbor_compare v1 v2 == (if res = 0s then Cbor.cbor_compare_map l1 l2 else I16.v res)) /\
(res == 0s ==> done == Nil? l1) /\
cont == (Cons? l1 && res = 0s)
)
{
let x1 = cbor_map_iterator_next pi1;
with v1' . assert (raw_data_item_map_entry_match p1 x1 v1');
with gi1' l1' . assert (pts_to pi1 gi1' ** cbor_map_iterator_match p1 gi1' l1');
stick_trans ()
#(raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1');
let x2 = cbor_map_iterator_next pi2;
with v2' . assert (raw_data_item_map_entry_match p2 x2 v2');
with gi2' l2' . assert (pts_to pi2 gi2' ** cbor_map_iterator_match p2 gi2' l2');
stick_trans ()
#(raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2');
unfold (raw_data_item_map_entry_match p1 x1 v1');
unfold (raw_data_item_map_entry_match p2 x2 v2');
let test = cbor_compare (cbor_map_entry_key x1) (cbor_map_entry_key x2);
if (test = 0s) ensures exists* res done . // FIXME: HOW HOW HOW can I frame some things out?
pts_to pi1 gi1' ** pts_to pi2 gi2' ** pts_to pdone done **
raw_data_item_match p1 (cbor_map_entry_key x1) (fstp v1') **
raw_data_item_match p2 (cbor_map_entry_key x2) (fstp v2') **
raw_data_item_match p1 (cbor_map_entry_value x1) (sndp v1') **
raw_data_item_match p2 (cbor_map_entry_value x2) (sndp v2') **
cbor_map_iterator_match p1 gi1' l1' **
cbor_map_iterator_match p2 gi2' l2' **
((raw_data_item_map_entry_match p1 x1 v1' ** cbor_map_iterator_match p1 gi1' l1') @==> raw_data_item_match p1 a1 v1) **
((raw_data_item_map_entry_match p2 x2 v2' ** cbor_map_iterator_match p2 gi2' l2') @==> raw_data_item_match p2 a2 v2) **
pts_to pres res ** pure ((I16.v res <: int) == (if Cbor.cbor_compare (fstp v1') (fstp v2') <> 0 then Cbor.cbor_compare (fstp v1') (fstp v2') else Cbor.cbor_compare (sndp v1') (sndp v2')))
{
let test = cbor_compare (cbor_map_entry_value x1) (cbor_map_entry_value x2);
pres := test;
} else {
pres := test;
};
fold (raw_data_item_map_entry_match p1 x1 v1');
fold (raw_data_item_map_entry_match p2 x2 v2');
stick_consume_l ()
#(raw_data_item_map_entry_match p1 x1 v1')
#(cbor_map_iterator_match p1 gi1' l1');
stick_consume_l ()
#(raw_data_item_map_entry_match p2 x2 v2')
#(cbor_map_iterator_match p2 gi2' l2');
let res = !pres;
if (res = 0s) {
let i1 = !pi1;
rewrite each gi1' as i1;
let done = cbor_map_iterator_is_done i1;
pdone := done
}
};
elim_stick0 ();
elim_stick0 ();
!pres
}
} else {
// unreachable
let unused : squash False = ();
2s
}
}
}
```
```pulse
fn cbor_is_equal
(a1: cbor)
(a2: cbor)
(#p1: perm)
(#p2: perm)
(#v1: Ghost.erased Cbor.raw_data_item)
(#v2: Ghost.erased Cbor.raw_data_item)
requires
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2)
returns res: bool
ensures
(raw_data_item_match p1 a1 v1 ** raw_data_item_match p2 a2 v2 ** pure (
(res == true <==> v1 == v2)
))
{
Cbor.cbor_compare_equal v1 v2;
let test = cbor_compare a1 a2;
(test = 0s)
}
```
noeq
type cbor_map_get_t =
| Found of cbor
| NotFound
let rec list_ghost_assoc
(#key: Type)
(#value: Type)
(k: key)
(m: list (key & value))
: GTot (option value)
(decreases m)
= match m with
| [] -> None
| (k', v') :: m' ->
if FStar.StrongExcludedMiddle.strong_excluded_middle (k == k')
then Some v'
else list_ghost_assoc k m'
let cbor_map_get_post_not_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
: Tot vprop
= raw_data_item_match p map vmap ** pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == None
)
let cbor_map_get_post_found
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(value: cbor)
: Tot vprop
= exists* vvalue.
raw_data_item_match p value vvalue **
(raw_data_item_match p value vvalue @==> raw_data_item_match p map vmap) **
pure (
Cbor.Map? vmap /\
list_ghost_assoc vkey (Cbor.Map?.v vmap) == Some vvalue
)
let cbor_map_get_post
(p: perm)
(vkey: Cbor.raw_data_item)
(vmap: Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
: Tot vprop
= match res with
| NotFound -> cbor_map_get_post_not_found p vkey vmap map
| Found value -> cbor_map_get_post_found p vkey vmap map value | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Stick.fsti.checked",
"Pulse.Lib.SeqMatch.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.ArraySwap.fsti.checked",
"Pulse.Lib.Array.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"CBOR.Spec.Constants.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.Extern.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Pulse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int16",
"short_module": "I16"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": true,
"full_module": "Pulse.Lib.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "CBOR.Spec",
"short_module": "Cbor"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Stick",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse.Extern",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"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 |
pmap: PulseCore.FractionalPermission.perm ->
vkey: FStar.Ghost.erased CBOR.Spec.Type.raw_data_item ->
vmap: FStar.Ghost.erased CBOR.Spec.Type.raw_data_item ->
map: CBOR.Pulse.Type.cbor ->
res: CBOR.Pulse.cbor_map_get_t ->
i: CBOR.Pulse.Type.cbor_map_iterator_t ->
l: Prims.list (CBOR.Spec.Type.raw_data_item * CBOR.Spec.Type.raw_data_item)
-> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"PulseCore.FractionalPermission.perm",
"FStar.Ghost.erased",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Pulse.Type.cbor",
"CBOR.Pulse.cbor_map_get_t",
"CBOR.Pulse.Type.cbor_map_iterator_t",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"Pulse.Lib.Core.op_Star_Star",
"CBOR.Pulse.cbor_map_get_post_found",
"FStar.Ghost.reveal",
"Pulse.Lib.Core.pure",
"Prims.l_and",
"Prims.b2t",
"CBOR.Spec.Type.uu___is_Map",
"FStar.Pervasives.Native.uu___is_Some",
"CBOR.Pulse.list_ghost_assoc",
"CBOR.Spec.Type.__proj__Map__item__v",
"CBOR.Pulse.Extern.cbor_map_iterator_match",
"Pulse.Lib.Stick.op_At_Equals_Equals_Greater",
"CBOR.Pulse.Extern.raw_data_item_match",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"Pulse.Lib.Core.vprop"
] | [] | false | false | false | true | false | let cbor_map_get_invariant
(pmap: perm)
(vkey vmap: Ghost.erased Cbor.raw_data_item)
(map: cbor)
(res: cbor_map_get_t)
(i: cbor_map_iterator_t)
(l: list (Cbor.raw_data_item & Cbor.raw_data_item))
: Tot vprop =
| match res with
| Found value ->
cbor_map_get_post_found pmap vkey vmap map value **
pure (Cbor.Map? vmap /\ Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap)))
| NotFound ->
(cbor_map_iterator_match pmap i l **
(cbor_map_iterator_match pmap i l @==> raw_data_item_match pmap map vmap)) **
pure (Cbor.Map? vmap /\
list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap) ==
list_ghost_assoc (Ghost.reveal vkey) l) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_avx2_support | val va_quick_Check_avx2_support: Prims.unit -> (va_quickCode unit (va_code_Check_avx2_support ())) | val va_quick_Check_avx2_support: Prims.unit -> (va_quickCode unit (va_code_Check_avx2_support ())) | let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 192,
"start_col": 0,
"start_line": 189
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_avx2_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_avx2_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_avx2_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_avx2_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
| (va_QProc (va_code_Check_avx2_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_avx2_support
va_wpProof_Check_avx2_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_movbe_support | val va_quick_Check_movbe_support: Prims.unit -> (va_quickCode unit (va_code_Check_movbe_support ())) | val va_quick_Check_movbe_support: Prims.unit -> (va_quickCode unit (va_code_Check_movbe_support ())) | let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 226,
"start_col": 0,
"start_line": 223
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_movbe_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_movbe_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_movbe_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_movbe_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
| (va_QProc (va_code_Check_movbe_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_movbe_support
va_wpProof_Check_movbe_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_adx_bmi2_support | val va_quick_Check_adx_bmi2_support: Prims.unit
-> (va_quickCode unit (va_code_Check_adx_bmi2_support ())) | val va_quick_Check_adx_bmi2_support: Prims.unit
-> (va_quickCode unit (va_code_Check_adx_bmi2_support ())) | let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 124,
"start_col": 0,
"start_line": 121
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.Lib.X64.Cpuid.va_code_Check_adx_bmi2_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_adx_bmi2_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_adx_bmi2_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_adx_bmi2_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
| (va_QProc (va_code_Check_adx_bmi2_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_sse_support | val va_quick_Check_sse_support: Prims.unit -> (va_quickCode unit (va_code_Check_sse_support ())) | val va_quick_Check_sse_support: Prims.unit -> (va_quickCode unit (va_code_Check_sse_support ())) | let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 260,
"start_col": 0,
"start_line": 257
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_sse_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_sse_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_sse_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_sse_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
| (va_QProc (va_code_Check_sse_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_sse_support
va_wpProof_Check_sse_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_avx_xcr0_support | val va_quick_Check_avx_xcr0_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx_xcr0_support ())) | val va_quick_Check_avx_xcr0_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx_xcr0_support ())) | let va_quick_Check_avx_xcr0_support () : (va_quickCode unit (va_code_Check_avx_xcr0_support ())) =
(va_QProc (va_code_Check_avx_xcr0_support ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRax]) va_wp_Check_avx_xcr0_support va_wpProof_Check_avx_xcr0_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 93,
"end_line": 397,
"start_col": 0,
"start_line": 395
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_osxsave_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_osxsave_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_osxsave_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
(va_QProc (va_code_Check_osxsave_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support)
//--
//-- Check_avx_xcr0_support
val va_code_Check_avx_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_xcr0_support ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\ va_state_eq va_sM (va_update_flags 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_qattr]
let va_wp_Check_avx_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) ==> va_k va_sM (())))
val va_wpProof_Check_avx_xcr0_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_xcr0_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_xcr0_support ())
([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.Lib.X64.Cpuid.va_code_Check_avx_xcr0_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_avx_xcr0_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_avx_xcr0_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_avx_xcr0_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_avx_xcr0_support () : (va_quickCode unit (va_code_Check_avx_xcr0_support ())) =
| (va_QProc (va_code_Check_avx_xcr0_support ())
([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax])
va_wp_Check_avx_xcr0_support
va_wpProof_Check_avx_xcr0_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_avx512_support | val va_quick_Check_avx512_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx512_support ())) | val va_quick_Check_avx512_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx512_support ())) | let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 331,
"start_col": 0,
"start_line": 328
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_avx512_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_avx512_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_avx512_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_avx512_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
| (va_QProc (va_code_Check_avx512_support ())
([
va_Mod_flags;
va_Mod_reg64 rR11;
va_Mod_reg64 rR10;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_avx512_support
va_wpProof_Check_avx512_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_rdrand_support | val va_quick_Check_rdrand_support: Prims.unit
-> (va_quickCode unit (va_code_Check_rdrand_support ())) | val va_quick_Check_rdrand_support: Prims.unit
-> (va_quickCode unit (va_code_Check_rdrand_support ())) | let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 294,
"start_col": 0,
"start_line": 291
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Lib.X64.Cpuid.va_code_Check_rdrand_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_rdrand_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_rdrand_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_rdrand_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
| (va_QProc (va_code_Check_rdrand_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_avx512_xcr0_support | val va_quick_Check_avx512_xcr0_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx512_xcr0_support ())) | val va_quick_Check_avx512_xcr0_support: Prims.unit
-> (va_quickCode unit (va_code_Check_avx512_xcr0_support ())) | let va_quick_Check_avx512_xcr0_support () : (va_quickCode unit (va_code_Check_avx512_xcr0_support
())) =
(va_QProc (va_code_Check_avx512_xcr0_support ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRax]) va_wp_Check_avx512_xcr0_support va_wpProof_Check_avx512_xcr0_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 99,
"end_line": 430,
"start_col": 0,
"start_line": 427
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_osxsave_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_osxsave_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_osxsave_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
(va_QProc (va_code_Check_osxsave_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support)
//--
//-- Check_avx_xcr0_support
val va_code_Check_avx_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_xcr0_support ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\ va_state_eq va_sM (va_update_flags 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_qattr]
let va_wp_Check_avx_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) ==> va_k va_sM (())))
val va_wpProof_Check_avx_xcr0_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_xcr0_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_xcr0_support ())
([va_Mod_flags; 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" va_qattr]
let va_quick_Check_avx_xcr0_support () : (va_quickCode unit (va_code_Check_avx_xcr0_support ())) =
(va_QProc (va_code_Check_avx_xcr0_support ()) ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRax]) va_wp_Check_avx_xcr0_support va_wpProof_Check_avx_xcr0_support)
//--
//-- Check_avx512_xcr0_support
val va_code_Check_avx512_xcr0_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_xcr0_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_xcr0_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_xcr0_support ()) va_s0 /\ va_get_ok va_s0
/\ osxsave_enabled /\ avx_xcr0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) /\ va_state_eq va_sM (va_update_flags 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_qattr]
let va_wp_Check_avx512_xcr0_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ avx_xcr0 /\ (forall (va_x_rax:nat64) (va_x_rcx:nat64)
(va_x_rdx:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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 /\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) ==> va_k va_sM (())))
val va_wpProof_Check_avx512_xcr0_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_xcr0_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_xcr0_support ())
([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.Lib.X64.Cpuid.va_code_Check_avx512_xcr0_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_avx512_xcr0_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_avx512_xcr0_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_avx512_xcr0_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_avx512_xcr0_support ()
: (va_quickCode unit (va_code_Check_avx512_xcr0_support ())) =
| (va_QProc (va_code_Check_avx512_xcr0_support ())
([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax])
va_wp_Check_avx512_xcr0_support
va_wpProof_Check_avx512_xcr0_support) | false |
Vale.Lib.X64.Cpuid.fsti | Vale.Lib.X64.Cpuid.va_quick_Check_osxsave_support | val va_quick_Check_osxsave_support: Prims.unit
-> (va_quickCode unit (va_code_Check_osxsave_support ())) | val va_quick_Check_osxsave_support: Prims.unit
-> (va_quickCode unit (va_code_Check_osxsave_support ())) | let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
(va_QProc (va_code_Check_osxsave_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support) | {
"file_name": "obj/Vale.Lib.X64.Cpuid.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 37,
"end_line": 365,
"start_col": 0,
"start_line": 362
} | module Vale.Lib.X64.Cpuid
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
//let pow2_values (u:unit) : Lemma
// (pow2 29 == 0x20000000 /\
// pow2 25 == 0x2000000 /\
// pow2 1 == 0x2)
// =
// assert_norm (pow2 29 == 0x20000000);
// assert_norm (0x2000000 == pow2 25);
// assert_norm (0x2 == pow2 1);
// ()
//-- Check_aesni_support
val va_code_Check_aesni_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_aesni_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_aesni_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_aesni_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx
va_sM == va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64
rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_aesni_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
aesni_enabled /\ pclmulqdq_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==>
va_k va_sM (())))
val va_wpProof_Check_aesni_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_aesni_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_aesni_support () : (va_quickCode unit (va_code_Check_aesni_support ())) =
(va_QProc (va_code_Check_aesni_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_aesni_support
va_wpProof_Check_aesni_support)
//--
//-- Check_sha_support
val va_code_Check_sha_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sha_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sha_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sha_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sha_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sha_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sha_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sha_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sha_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sha_support () : (va_quickCode unit (va_code_Check_sha_support ())) =
(va_QProc (va_code_Check_sha_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sha_support
va_wpProof_Check_sha_support)
//--
//-- Check_adx_bmi2_support
val va_code_Check_adx_bmi2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_adx_bmi2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_adx_bmi2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_adx_bmi2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_adx_bmi2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
adx_enabled /\ bmi2_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k
va_sM (())))
val va_wpProof_Check_adx_bmi2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_adx_bmi2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_adx_bmi2_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_adx_bmi2_support () : (va_quickCode unit (va_code_Check_adx_bmi2_support ())) =
(va_QProc (va_code_Check_adx_bmi2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_adx_bmi2_support
va_wpProof_Check_adx_bmi2_support)
//--
//-- Check_avx_support
val va_code_Check_avx_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx_support () : (va_quickCode unit (va_code_Check_avx_support ())) =
(va_QProc (va_code_Check_avx_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx_support
va_wpProof_Check_avx_support)
//--
//-- Check_avx2_support
val va_code_Check_avx2_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx2_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx2_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx2_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_avx2_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
avx2_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_avx2_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx2_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx2_support () : (va_quickCode unit (va_code_Check_avx2_support ())) =
(va_QProc (va_code_Check_avx2_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_avx2_support
va_wpProof_Check_avx2_support)
//--
//-- Check_movbe_support
val va_code_Check_movbe_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_movbe_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_movbe_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_movbe_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
movbe_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_movbe_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_movbe_support () : (va_quickCode unit (va_code_Check_movbe_support ())) =
(va_QProc (va_code_Check_movbe_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_movbe_support
va_wpProof_Check_movbe_support)
//--
//-- Check_sse_support
val va_code_Check_sse_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_sse_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_sse_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_sse_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx
va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_sse_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
sse_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_sse_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_sse_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_support ()) ([va_Mod_flags;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_sse_support () : (va_quickCode unit (va_code_Check_sse_support ())) =
(va_QProc (va_code_Check_sse_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_sse_support
va_wpProof_Check_sse_support)
//--
//-- Check_rdrand_support
val va_code_Check_rdrand_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_rdrand_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_rdrand_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_rdrand_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_rdrand_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
rdrand_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_rdrand_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_rdrand_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_rdrand_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_rdrand_support () : (va_quickCode unit (va_code_Check_rdrand_support ())) =
(va_QProc (va_code_Check_rdrand_support ()) ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_wp_Check_rdrand_support
va_wpProof_Check_rdrand_support)
//--
//-- Check_avx512_support
val va_code_Check_avx512_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_avx512_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_avx512_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_avx512_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM ==
va_get_reg64 rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 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_s0)))))))))))
[@ va_qattr]
let va_wp_Check_avx512_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR9
va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0
==> avx512_cpuid_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM
(())))
val va_wpProof_Check_avx512_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_avx512_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_support ())
([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Check_avx512_support () : (va_quickCode unit (va_code_Check_avx512_support ())) =
(va_QProc (va_code_Check_avx512_support ()) ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Check_avx512_support va_wpProof_Check_avx512_support)
//--
//-- Check_osxsave_support
val va_code_Check_osxsave_support : va_dummy:unit -> Tot va_code
val va_codegen_success_Check_osxsave_support : va_dummy:unit -> Tot va_pbool
val va_lemma_Check_osxsave_support : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Check_osxsave_support ()) 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 /\
(va_get_reg64 rRax va_sM =!= 0 ==> osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64
rRbx va_s0 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 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_s0)))))))))
[@ va_qattr]
let va_wp_Check_osxsave_support (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64)
(va_x_r9:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR9 va_x_r9 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRax va_x_rax va_s0))))) in va_get_ok va_sM /\ (va_get_reg64 rRax va_sM =!= 0 ==>
osxsave_enabled) /\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 ==> va_k va_sM (())))
val va_wpProof_Check_osxsave_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Check_osxsave_support va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_osxsave_support ())
([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.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.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.X64.Cpuid.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_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.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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"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.Lib.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.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.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.Lib.X64.Cpuid.va_code_Check_osxsave_support ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.Lib.X64.Cpuid.va_code_Check_osxsave_support",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.Lib.X64.Cpuid.va_wp_Check_osxsave_support",
"Vale.Lib.X64.Cpuid.va_wpProof_Check_osxsave_support",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Check_osxsave_support () : (va_quickCode unit (va_code_Check_osxsave_support ())) =
| (va_QProc (va_code_Check_osxsave_support ())
([
va_Mod_flags;
va_Mod_reg64 rR9;
va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRbx;
va_Mod_reg64 rRax
])
va_wp_Check_osxsave_support
va_wpProof_Check_osxsave_support) | false |
Steel.ST.OnRange.fsti | Steel.ST.OnRange.on_range_weaken_and_shift | val on_range_weaken_and_shift
(#opened: _)
(p p': (nat -> vprop))
(delta: int)
(i: nat{i + delta >= 0})
(j: nat)
(phi: (k: nat{i <= k /\ k < j} -> STGhostT unit opened (p k) (fun _ -> p' (k + delta))))
(i': nat{i' == i + delta})
(j': nat{j' == j + delta})
: STGhostT unit
opened
(on_range p i j)
(fun _ -> on_range p' i' j')
(decreases (if j >= i then j - i else 0)) | val on_range_weaken_and_shift
(#opened: _)
(p p': (nat -> vprop))
(delta: int)
(i: nat{i + delta >= 0})
(j: nat)
(phi: (k: nat{i <= k /\ k < j} -> STGhostT unit opened (p k) (fun _ -> p' (k + delta))))
(i': nat{i' == i + delta})
(j': nat{j' == j + delta})
: STGhostT unit
opened
(on_range p i j)
(fun _ -> on_range p' i' j')
(decreases (if j >= i then j - i else 0)) | let rec on_range_weaken_and_shift
(#opened: _)
(p p': (nat -> vprop))
(delta: int)
(i: nat { i + delta >= 0 })
(j: nat)
(phi: (k: nat { i <= k /\ k < j }) -> STGhostT unit opened (p k) (fun _ -> p' (k + delta)))
(i': nat { i' == i + delta })
(j': nat { j' == j + delta })
: STGhostT unit opened
(on_range p i j)
(fun _ -> on_range p' i' j')
(decreases (if j >= i then j - i else 0))
= on_range_le p i j;
if j <= i
then begin
drop (on_range p i j);
on_range_empty p' i' j'
end else begin
on_range_split p i (i + 1) j;
on_range_singleton_elim p i (i + 1);
phi i;
rewrite (p' _) (p' i');
on_range_singleton_intro p' i' (i' + 1);
on_range_weaken_and_shift p p' delta (i + 1) j phi (i' + 1) j';
on_range_join p' i' (i' + 1) j'
end | {
"file_name": "lib/steel/Steel.ST.OnRange.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 225,
"start_col": 0,
"start_line": 199
} | module Steel.ST.OnRange
include Steel.ST.Util
val on_range (p: (nat -> vprop)) (i j: nat) : vprop
val on_range_le
(#opened: _)
(p: (nat -> vprop))
(i j: nat)
: STGhost unit opened
(on_range p i j)
(fun _ -> on_range p i j)
True
(fun _ -> i <= j)
val on_range_empty
(#opened: _)
(p: (nat -> vprop))
(i: nat)
(j: nat)
: STGhost unit opened
emp
(fun _ -> on_range p i j)
(i == j)
(fun _ -> True)
val on_range_singleton_intro
(#opened: _)
(p: (nat -> vprop))
(i: nat)
(j: nat)
: STGhost unit opened
(p i)
(fun _ -> on_range p i j)
(j == i + 1)
(fun _ -> True)
val on_range_singleton_elim
(#opened: _)
(p: (nat -> vprop))
(i j: nat)
: STGhost unit opened
(on_range p i j)
(fun _ -> p i)
(j == i + 1)
(fun _ -> True)
val on_range_split
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(on_range p i k)
(fun _ -> on_range p i j `star` on_range p j k)
(i <= j /\ j <= k)
(fun _ -> True)
val on_range_join
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhostT unit opened
(on_range p i j `star` on_range p j k)
(fun _ -> on_range p i k)
let on_range_cons
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(p i `star` on_range p j k)
(fun _ -> on_range p i k)
(j == i + 1)
(fun _ -> True)
= on_range_singleton_intro p i j;
on_range_join p i j k
let on_range_uncons
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(on_range p i k)
(fun _ -> p i `star` on_range p j k)
(j == i + 1 /\ j <= k)
(fun _ -> True)
= on_range_split p i j k;
on_range_singleton_elim p i j
let on_range_cons_with_implies
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(p i `star` on_range p j k)
(fun _ -> on_range p i k `star`
(on_range p i k @==> (p i `star` on_range p j k))
)
(j == i + 1)
(fun _ -> True)
= on_range_le p j k;
on_range_cons p i j k;
intro_implies
(on_range p i k)
(p i `star` on_range p j k)
emp
(fun _ -> on_range_uncons p i j k)
let on_range_snoc
(#opened: _)
(p: (nat -> vprop))
(i j j' k: nat)
: STGhost unit opened
(on_range p i j `star` p j')
(fun _ -> on_range p i k)
(j' == j /\ k == j + 1)
(fun _ -> True)
= rewrite (p j') (p j);
on_range_singleton_intro p j k;
on_range_join p i j k
let on_range_unsnoc
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(on_range p i k)
(fun _ -> on_range p i j `star` p j)
(i <= j /\ k == j + 1)
(fun _ -> True)
= on_range_split p i j k;
on_range_singleton_elim p j k
let on_range_snoc_with_implies
(#opened: _)
(p: (nat -> vprop))
(i j j' k: nat)
: STGhost unit opened
(on_range p i j `star` p j')
(fun _ -> on_range p i k `star` (on_range p i k `implies_` (on_range p i j `star` p j')))
(j' == j /\ k == j + 1)
(fun _ -> True)
= on_range_le p i j;
on_range_snoc p i j j' k;
intro_implies
(on_range p i k)
(on_range p i j `star` p j')
emp
(fun _ ->
on_range_unsnoc p i j k;
rewrite (p j) (p j')
)
let on_range_get
(#opened: _)
(p: (nat -> vprop))
(i j k l: nat)
: STGhost unit opened
(on_range p i l)
(fun _ -> on_range p i j `star` p j `star` on_range p k l)
(i <= j /\ j + 1 == k /\ k <= l)
(fun _ -> True)
= on_range_split p i j l;
on_range_split p j k l;
on_range_singleton_elim p j k
let on_range_put
(#opened: _)
(p: (nat -> vprop))
(i j k l m: nat)
: STGhost unit opened
(on_range p i j `star` p k `star` on_range p l m)
(fun _ -> on_range p i m)
(j == k /\ k + 1 == l)
(fun _ -> True)
= rewrite (p k) (p j);
on_range_singleton_intro p j l;
on_range_join p i j l;
on_range_join p i l m
let on_range_focus
(#opened: _)
(p: (nat -> vprop))
(i j k: nat)
: STGhost unit opened
(on_range p i k)
(fun _ -> p j `star` (p j `implies_` on_range p i k))
(i <= j /\ j < k)
(fun _ -> True)
= on_range_get p i j (j + 1) k;
intro_implies
(p j)
(on_range p i k)
(on_range p i j `star` on_range p (j + 1) k)
(fun _ ->
on_range_put p i j j (j + 1) k
) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.OnRange.fsti"
} | [
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: (_: Prims.nat -> Steel.Effect.Common.vprop) ->
p': (_: Prims.nat -> Steel.Effect.Common.vprop) ->
delta: Prims.int ->
i: Prims.nat{i + delta >= 0} ->
j: Prims.nat ->
phi: (k: Prims.nat{i <= k /\ k < j} -> Steel.ST.Effect.Ghost.STGhostT Prims.unit) ->
i': Prims.nat{i' == i + delta} ->
j': Prims.nat{j' == j + delta}
-> Steel.ST.Effect.Ghost.STGhostT Prims.unit | Steel.ST.Effect.Ghost.STGhostT | [
""
] | [] | [
"Steel.Memory.inames",
"Prims.nat",
"Steel.Effect.Common.vprop",
"Prims.int",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Addition",
"Prims.l_and",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.unit",
"Prims.eq2",
"Steel.ST.OnRange.on_range_empty",
"Steel.ST.Util.drop",
"Steel.ST.OnRange.on_range",
"Prims.bool",
"Steel.ST.OnRange.on_range_join",
"Steel.ST.OnRange.on_range_weaken_and_shift",
"Steel.ST.OnRange.on_range_singleton_intro",
"Steel.ST.Util.rewrite",
"Steel.ST.OnRange.on_range_singleton_elim",
"Steel.ST.OnRange.on_range_split",
"Steel.ST.OnRange.on_range_le"
] | [
"recursion"
] | false | true | false | false | false | let rec on_range_weaken_and_shift
(#opened: _)
(p p': (nat -> vprop))
(delta: int)
(i: nat{i + delta >= 0})
(j: nat)
(phi: (k: nat{i <= k /\ k < j} -> STGhostT unit opened (p k) (fun _ -> p' (k + delta))))
(i': nat{i' == i + delta})
(j': nat{j' == j + delta})
: STGhostT unit
opened
(on_range p i j)
(fun _ -> on_range p' i' j')
(decreases (if j >= i then j - i else 0)) =
| on_range_le p i j;
if j <= i
then
(drop (on_range p i j);
on_range_empty p' i' j')
else
(on_range_split p i (i + 1) j;
on_range_singleton_elim p i (i + 1);
phi i;
rewrite (p' _) (p' i');
on_range_singleton_intro p' i' (i' + 1);
on_range_weaken_and_shift p p' delta (i + 1) j phi (i' + 1) j';
on_range_join p' i' (i' + 1) j') | false |
TwoLockQueue.fst | TwoLockQueue.dequeue_core | val dequeue_core: #a: _ -> #u: _ -> hdl: t a -> hd: Q.t a -> unit
-> SteelAtomicT (option (Q.t a))
u
((queue_invariant hdl.head hdl.tail) `star` (ghost_pts_to hdl.head.ghost half hd))
(fun o -> (queue_invariant hdl.head hdl.tail) `star` (maybe_ghost_pts_to hdl.head.ghost hd o)) | val dequeue_core: #a: _ -> #u: _ -> hdl: t a -> hd: Q.t a -> unit
-> SteelAtomicT (option (Q.t a))
u
((queue_invariant hdl.head hdl.tail) `star` (ghost_pts_to hdl.head.ghost half hd))
(fun o -> (queue_invariant hdl.head hdl.tail) `star` (maybe_ghost_pts_to hdl.head.ghost hd o)) | let dequeue_core (#a:_) (#u:_) (hdl:t a) (hd:Q.t a) (_:unit)
: SteelAtomicT (option (Q.t a)) u
(queue_invariant hdl.head hdl.tail `star`
ghost_pts_to hdl.head.ghost half hd)
(fun o ->
queue_invariant hdl.head hdl.tail `star`
maybe_ghost_pts_to hdl.head.ghost hd o)
=
let h = open_exists () in
let t = open_exists () in
ghost_gather hd hdl.head.ghost;
// Attempts a concrete dequeue
let o = Queue.dequeue hd in
match o with
| None ->
// The list was empty, dequeue failed. We repack the invariant
rewrite (Q.dequeue_post _ _ _) (Q.queue hd t);
ghost_share_pt hdl.head.ghost;
pack_queue_invariant hd t hdl.head hdl.tail;
rewrite
(ghost_pts_to hdl.head.ghost _ _)
(maybe_ghost_pts_to _ _ _);
return o
| Some p ->
// dequeue succeeded, and returned element p
rewrite (Q.dequeue_post _ _ _) (Q.dequeue_post_success _ _ _);
let c = open_exists () in
elim_pure ();
intro_exists (reveal c) (pts_to hd full_perm);
// Updates the head ghost state
ghost_write_pt hdl.head.ghost p;
ghost_share_pt hdl.head.ghost;
// Repack the global queue invariant
pack_queue_invariant _ _ hdl.head hdl.tail;
assert (maybe_ghost_pts_to hdl.head.ghost hd (Some p) == ghost_pts_to hdl.head.ghost half p `star` h_exists (pts_to hd full_perm)) by (FStar.Tactics.norm [delta; iota; zeta]);
rewrite
(ghost_pts_to hdl.head.ghost half p `star` h_exists (pts_to hd full_perm))
(maybe_ghost_pts_to hdl.head.ghost hd o);
return o | {
"file_name": "share/steel/examples/steel/TwoLockQueue.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 14,
"end_line": 255,
"start_col": 0,
"start_line": 215
} | module TwoLockQueue
open FStar.Ghost
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.FractionalPermission
open Steel.Reference
open Steel.SpinLock
module L = FStar.List.Tot
module U = Steel.Utils
module Q = Queue
/// This module provides an implementation of Michael and Scott's two lock queue, using the
/// abstract interface for queues provided in Queue.fsti.
/// This implementation allows an enqueue and a dequeue operation to safely operate in parallel.
/// There is a lock associated to both the enqueuer and the dequeuer, which guards each of those operation,
/// ensuring that at most one enqueue (resp. dequeue) is happening at any time
/// We only prove that this implementation is memory safe, and do not prove the functional correctness of the concurrent queue
#push-options "--ide_id_info_off"
/// Adding the definition of the vprop equivalence to the context, for proof purposes
let _: squash (forall p q. p `equiv` q <==> hp_of p `Steel.Memory.equiv` hp_of q) =
Classical.forall_intro_2 reveal_equiv
(* Some wrappers to reduce clutter in the code *)
[@@__reduce__]
let full = full_perm
[@@__reduce__]
let half = half_perm full
(* Wrappers around fst and snd to avoid overnormalization.
TODO: The frame inference tactic should not normalize fst and snd *)
let fst x = fst x
let snd x = snd x
(* Some wrappers around Steel functions which are easier to use inside this module *)
let ghost_gather (#a:Type) (#u:_)
(#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})
(x0 #x1:erased a)
(r:ghost_ref a)
: SteelGhost unit u
(ghost_pts_to r p0 x0 `star`
ghost_pts_to r p1 x1)
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1)
= let _ = ghost_gather_pt #a #u #p0 #p1 r in ()
let rewrite #u (p q:vprop)
: SteelGhost unit u p (fun _ -> q)
(requires fun _ -> p `equiv` q)
(ensures fun _ _ _ -> True)
= rewrite_slprop p q (fun _ -> reveal_equiv p q)
let elim_pure (#p:prop) #u ()
: SteelGhost unit u
(pure p) (fun _ -> emp)
(requires fun _ -> True)
(ensures fun _ _ _ -> p)
= let _ = Steel.Effect.Atomic.elim_pure p in ()
let open_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit)
: SteelGhostT (Ghost.erased a) opened_invariants
(h_exists p) (fun r -> p (reveal r))
= let v : erased a = witness_exists () in
v
(*** Queue invariant ***)
/// The invariant associated to the lock. Basically a variant of the
/// Owicki-Gries invariant, but applied to queues
[@@__reduce__]
let lock_inv #a (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a)) =
h_exists (fun (v:Q.t a) ->
pts_to ptr full v `star`
ghost_pts_to ghost half v)
let intro_lock_inv #a #u (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a))
: SteelGhostT unit u
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v))
(fun _ -> lock_inv ptr ghost)
= assert_spinoff
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v) == lock_inv ptr ghost);
rewrite_slprop
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v))
(lock_inv _ _)
(fun _ -> ())
/// The type of a queue pointer.
/// Contains the concrete pointer [ptr], the pointer to ghost state [ghost],
/// and a lock [lock] protecting the invariant relating the concrete and ghost states
noeq
type q_ptr (a:Type) = {
ptr : ref (Q.t a);
ghost: ghost_ref (Q.t a);
lock: lock (lock_inv ptr ghost);
}
/// The global queue invariant, which will be shared by the enqueuer and the dequeuer.
/// Again, inspired by the Owicki-Gries counter: It contains half the permission for the ghost
/// state of the enqueuer and dequeuer, while ensuring that the concrete queue always remains
/// a valid queue
let queue_invariant (#a:_) ([@@@smt_fallback]head:q_ptr a) ([@@@smt_fallback] tail:q_ptr a) =
h_exists (fun (h:Q.t a) ->
h_exists (fun (t:Q.t a) ->
ghost_pts_to head.ghost half h `star`
ghost_pts_to tail.ghost half t `star`
Q.queue h t))
let pack_queue_invariant (#a:_) (#u:_) (x:erased (Q.t a)) (y:erased (Q.t a)) (head tail:q_ptr a)
: SteelGhostT unit u
(ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y)
(fun _ -> queue_invariant head tail)
= intro_exists (reveal y) (fun y -> ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y);
intro_exists (reveal x) (fun x -> h_exists (fun y -> ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y))
/// The type of a queue. It contains a head and tail pointers, each with their own ghost state,
/// as well as the global queue invariant [inv]. Note that compared to the locks in the head and tail
/// pointers with type `q_ptr`, since invariant is a true Steel invariant, only accessible inside
/// atomic computations
noeq
type t (a:Type0) = {
head : q_ptr a;
tail : q_ptr a;
inv : inv (queue_invariant head tail)
}
/// Creating a new queue.
let new_queue (#a:_) (x:a)
: SteelT (t a) emp (fun _ -> emp)
= let new_qptr (#a:_) (q:Q.t a)
: SteelT (q_ptr a) emp (fun qp -> ghost_pts_to qp.ghost half q)
= // Allocates the concrete pointer.
let ptr = alloc_pt q in
// Allocates the ghost state, and sets the corresponding lock invariant
let ghost = ghost_alloc_pt q in
ghost_share_pt ghost;
intro_exists _ (fun q -> pts_to ptr full q `star` ghost_pts_to ghost half q);
let lock = Steel.SpinLock.new_lock _ in
{ ptr; ghost; lock}
in
// Creating a concrete queue
let hd = Q.new_queue x in
// Creating the head and queue pointers
let head = new_qptr hd in
let tail = new_qptr hd in
// Creating the global queue invariant
pack_queue_invariant (hide hd) (hide hd) head tail;
let inv = new_invariant _ in
// Packing the different components to return a queue, as defined in type `t`
return ({ head; tail; inv })
#restart-solver
/// Enqueues element [x] in the queue [hdl]
let enqueue (#a:_) (hdl:t a) (x:a)
: SteelT unit emp (fun _ -> emp)
= // Blocks until it can acquire the tail lock corresponding to the enqueuer
Steel.SpinLock.acquire hdl.tail.lock;
let cell = Q.({ data = x; next = null} ) in
let v:erased (Q.t a) = open_exists () in
let tl = read_pt hdl.tail.ptr in
// Creates a new cell for the enqueued element
let node = alloc_pt cell in
// Core, atomic enqueue function, calling the concrete enqueue function while also
// modifying ghost state to preserve the invariants
let enqueue_core #u ()
: SteelAtomicT unit u
(queue_invariant hdl.head hdl.tail `star`
(ghost_pts_to hdl.tail.ghost half tl `star` pts_to node full cell))
(fun _ -> queue_invariant hdl.head hdl.tail `star`
ghost_pts_to hdl.tail.ghost half node)
= let open FStar.Ghost in
let h = open_exists () in
let t = open_exists () in
ghost_gather tl hdl.tail.ghost;
Q.enqueue tl node;
ghost_write_pt hdl.tail.ghost node;
ghost_share_pt #_ #_ hdl.tail.ghost;
pack_queue_invariant h (hide node) hdl.head hdl.tail;
return ()
in
// Actually executing the atomic enqueue operation while preserving the global queue invariant
let r1 = with_invariant hdl.inv enqueue_core in
// Updates the queue tail pointer
let r2 = write_pt hdl.tail.ptr node in
// Updates the queue tail ghost state
let r3 = intro_exists
_
(fun (n:(Q.t a)) -> pts_to hdl.tail.ptr full_perm n `star`
ghost_pts_to hdl.tail.ghost half n) in
// Releases the tail lock corresponding to the enqueuer
Steel.SpinLock.release hdl.tail.lock
let maybe_ghost_pts_to #a (x:ghost_ref (Q.t a)) ([@@@ smt_fallback] hd:Q.t a) (o:option (Q.t a)) =
match o with
| None -> ghost_pts_to x half hd
| Some next -> ghost_pts_to x half next `star` (h_exists (pts_to hd full_perm)) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.Reference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Queue.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "TwoLockQueue.fst"
} | [
{
"abbrev": true,
"full_module": "Queue",
"short_module": "Q"
},
{
"abbrev": true,
"full_module": "Steel.Utils",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 | hdl: TwoLockQueue.t a -> hd: Queue.Def.t a -> _: Prims.unit
-> Steel.Effect.Atomic.SteelAtomicT (FStar.Pervasives.Native.option (Queue.Def.t a)) | Steel.Effect.Atomic.SteelAtomicT | [] | [] | [
"Steel.Memory.inames",
"TwoLockQueue.t",
"Queue.Def.t",
"Prims.unit",
"Steel.Effect.Atomic.return",
"FStar.Pervasives.Native.option",
"Steel.Effect.Common.VStar",
"TwoLockQueue.maybe_ghost_pts_to",
"TwoLockQueue.__proj__Mkq_ptr__item__ghost",
"TwoLockQueue.__proj__Mkt__item__head",
"TwoLockQueue.queue_invariant",
"TwoLockQueue.__proj__Mkt__item__tail",
"Steel.Effect.Common.vprop",
"TwoLockQueue.rewrite",
"Steel.Reference.ghost_pts_to",
"Steel.FractionalPermission.half_perm",
"Steel.FractionalPermission.full_perm",
"TwoLockQueue.pack_queue_invariant",
"FStar.Ghost.hide",
"Steel.Reference.ghost_share_pt",
"Queue.dequeue_post",
"Queue.queue",
"FStar.Ghost.reveal",
"Steel.Effect.Common.star",
"TwoLockQueue.half",
"Steel.Effect.Atomic.h_exists",
"Queue.Def.cell",
"Steel.Reference.pts_to",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"FStar.Pervasives.Native.Some",
"FStar.Stubs.Tactics.V1.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.iota",
"FStar.Pervasives.zeta",
"Prims.Nil",
"Steel.Reference.ghost_write_pt",
"Steel.Effect.Atomic.intro_exists",
"TwoLockQueue.elim_pure",
"Steel.Reference.ref",
"Queue.Def.__proj__Mkcell__item__next",
"FStar.Ghost.erased",
"TwoLockQueue.open_exists",
"Queue.pts_to",
"Steel.Effect.Common.pure",
"Queue.dequeue_post_success",
"Queue.dequeue",
"TwoLockQueue.ghost_gather"
] | [] | false | true | false | false | false | let dequeue_core (#a: _) (#u: _) (hdl: t a) (hd: Q.t a) (_: unit)
: SteelAtomicT (option (Q.t a))
u
((queue_invariant hdl.head hdl.tail) `star` (ghost_pts_to hdl.head.ghost half hd))
(fun o -> (queue_invariant hdl.head hdl.tail) `star` (maybe_ghost_pts_to hdl.head.ghost hd o)) =
| let h = open_exists () in
let t = open_exists () in
ghost_gather hd hdl.head.ghost;
let o = Queue.dequeue hd in
match o with
| None ->
rewrite (Q.dequeue_post _ _ _) (Q.queue hd t);
ghost_share_pt hdl.head.ghost;
pack_queue_invariant hd t hdl.head hdl.tail;
rewrite (ghost_pts_to hdl.head.ghost _ _) (maybe_ghost_pts_to _ _ _);
return o
| Some p ->
rewrite (Q.dequeue_post _ _ _) (Q.dequeue_post_success _ _ _);
let c = open_exists () in
elim_pure ();
intro_exists (reveal c) (pts_to hd full_perm);
ghost_write_pt hdl.head.ghost p;
ghost_share_pt hdl.head.ghost;
pack_queue_invariant _ _ hdl.head hdl.tail;
FStar.Tactics.Effect.assert_by_tactic (maybe_ghost_pts_to hdl.head.ghost hd (Some p) ==
(ghost_pts_to hdl.head.ghost half p)
`star`
(h_exists (pts_to hd full_perm)))
(fun _ ->
();
(FStar.Tactics.norm [delta; iota; zeta]));
rewrite ((ghost_pts_to hdl.head.ghost half p) `star` (h_exists (pts_to hd full_perm)))
(maybe_ghost_pts_to hdl.head.ghost hd o);
return o | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_aad | val test_aad:lbytes 12 | val test_aad:lbytes 12 | let test_aad : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy;
0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy ] in
assert_norm (List.Tot.length l == 12);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 60,
"start_col": 0,
"start_line": 55
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 12 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_aad:lbytes 12 =
| let l =
List.Tot.map u8_from_UInt8
[0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy]
in
assert_norm (List.Tot.length l == 12);
of_list l | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_nonce | val test_nonce:lbytes 12 | val test_nonce:lbytes 12 | let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 31,
"start_col": 0,
"start_line": 26
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 12 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_nonce:lbytes 12 =
| let l =
List.Tot.map u8_from_UInt8
[0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy]
in
assert_norm (List.Tot.length l == 12);
of_list l | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_key | val test_key:lbytes 32 | val test_key:lbytes 32 | let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 23,
"start_col": 0,
"start_line": 16
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *) | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_key:lbytes 32 =
| let l =
List.Tot.map u8_from_UInt8
[
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy; 0x88uy; 0x89uy; 0x8auy; 0x8buy;
0x8cuy; 0x8duy; 0x8euy; 0x8fuy; 0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy
]
in
assert_norm (List.Tot.length l == 32);
of_list l | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_mac | val test_mac:lbytes 16 | val test_mac:lbytes 16 | let test_mac : lbytes 16 =
let l = List.Tot.map u8_from_UInt8 [
0x1auy; 0xe1uy; 0x0buy; 0x59uy; 0x4fuy; 0x09uy; 0xe2uy; 0x6auy;
0x7euy; 0x90uy; 0x2euy; 0xcbuy; 0xd0uy; 0x60uy; 0x06uy; 0x91uy ] in
assert_norm (List.Tot.length l == 16);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 89,
"start_col": 0,
"start_line": 84
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_aad : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy;
0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_cipher : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0xd3uy; 0x1auy; 0x8duy; 0x34uy; 0x64uy; 0x8euy; 0x60uy; 0xdbuy;
0x7buy; 0x86uy; 0xafuy; 0xbcuy; 0x53uy; 0xefuy; 0x7euy; 0xc2uy;
0xa4uy; 0xaduy; 0xeduy; 0x51uy; 0x29uy; 0x6euy; 0x08uy; 0xfeuy;
0xa9uy; 0xe2uy; 0xb5uy; 0xa7uy; 0x36uy; 0xeeuy; 0x62uy; 0xd6uy;
0x3duy; 0xbeuy; 0xa4uy; 0x5euy; 0x8cuy; 0xa9uy; 0x67uy; 0x12uy;
0x82uy; 0xfauy; 0xfbuy; 0x69uy; 0xdauy; 0x92uy; 0x72uy; 0x8buy;
0x1auy; 0x71uy; 0xdeuy; 0x0auy; 0x9euy; 0x06uy; 0x0buy; 0x29uy;
0x05uy; 0xd6uy; 0xa5uy; 0xb6uy; 0x7euy; 0xcduy; 0x3buy; 0x36uy;
0x92uy; 0xdduy; 0xbduy; 0x7fuy; 0x2duy; 0x77uy; 0x8buy; 0x8cuy;
0x98uy; 0x03uy; 0xaeuy; 0xe3uy; 0x28uy; 0x09uy; 0x1buy; 0x58uy;
0xfauy; 0xb3uy; 0x24uy; 0xe4uy; 0xfauy; 0xd6uy; 0x75uy; 0x94uy;
0x55uy; 0x85uy; 0x80uy; 0x8buy; 0x48uy; 0x31uy; 0xd7uy; 0xbcuy;
0x3fuy; 0xf4uy; 0xdeuy; 0xf0uy; 0x8euy; 0x4buy; 0x7auy; 0x9duy;
0xe5uy; 0x76uy; 0xd2uy; 0x65uy; 0x86uy; 0xceuy; 0xc6uy; 0x4buy;
0x61uy; 0x16uy; ] in
assert_norm (List.Tot.length l == 114);
of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 16 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_mac:lbytes 16 =
| let l =
List.Tot.map u8_from_UInt8
[
0x1auy; 0xe1uy; 0x0buy; 0x59uy; 0x4fuy; 0x09uy; 0xe2uy; 0x6auy; 0x7euy; 0x90uy; 0x2euy; 0xcbuy;
0xd0uy; 0x60uy; 0x06uy; 0x91uy
]
in
assert_norm (List.Tot.length l == 16);
of_list l | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test | val test : _: Prims.unit -> FStar.All.ALL Prims.bool | let test () =
let res =
test_aead
test_key test_nonce test_plaintext test_aad test_cipher test_mac in
if res
then begin IO.print_string "\nChacha20Poly1305: Success! \o/ \n"; true end
else begin IO.print_string "\nChacha20Poly1305: Failure :(\n"; false end | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 131,
"start_col": 0,
"start_line": 124
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_aad : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy;
0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_cipher : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0xd3uy; 0x1auy; 0x8duy; 0x34uy; 0x64uy; 0x8euy; 0x60uy; 0xdbuy;
0x7buy; 0x86uy; 0xafuy; 0xbcuy; 0x53uy; 0xefuy; 0x7euy; 0xc2uy;
0xa4uy; 0xaduy; 0xeduy; 0x51uy; 0x29uy; 0x6euy; 0x08uy; 0xfeuy;
0xa9uy; 0xe2uy; 0xb5uy; 0xa7uy; 0x36uy; 0xeeuy; 0x62uy; 0xd6uy;
0x3duy; 0xbeuy; 0xa4uy; 0x5euy; 0x8cuy; 0xa9uy; 0x67uy; 0x12uy;
0x82uy; 0xfauy; 0xfbuy; 0x69uy; 0xdauy; 0x92uy; 0x72uy; 0x8buy;
0x1auy; 0x71uy; 0xdeuy; 0x0auy; 0x9euy; 0x06uy; 0x0buy; 0x29uy;
0x05uy; 0xd6uy; 0xa5uy; 0xb6uy; 0x7euy; 0xcduy; 0x3buy; 0x36uy;
0x92uy; 0xdduy; 0xbduy; 0x7fuy; 0x2duy; 0x77uy; 0x8buy; 0x8cuy;
0x98uy; 0x03uy; 0xaeuy; 0xe3uy; 0x28uy; 0x09uy; 0x1buy; 0x58uy;
0xfauy; 0xb3uy; 0x24uy; 0xe4uy; 0xfauy; 0xd6uy; 0x75uy; 0x94uy;
0x55uy; 0x85uy; 0x80uy; 0x8buy; 0x48uy; 0x31uy; 0xd7uy; 0xbcuy;
0x3fuy; 0xf4uy; 0xdeuy; 0xf0uy; 0x8euy; 0x4buy; 0x7auy; 0x9duy;
0xe5uy; 0x76uy; 0xd2uy; 0x65uy; 0x86uy; 0xceuy; 0xc6uy; 0x4buy;
0x61uy; 0x16uy; ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_mac : lbytes 16 =
let l = List.Tot.map u8_from_UInt8 [
0x1auy; 0xe1uy; 0x0buy; 0x59uy; 0x4fuy; 0x09uy; 0xe2uy; 0x6auy;
0x7euy; 0x90uy; 0x2euy; 0xcbuy; 0xd0uy; 0x60uy; 0x06uy; 0x91uy ] in
assert_norm (List.Tot.length l == 16);
of_list l
#set-options "--ifuel 2"
val test_aead:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64}
-> c_expected:bytes{length c_expected = length m}
-> mac_expected:tag ->
FStar.All.ML bool
let test_aead k n m aad c_expected mac_expected =
let enc = aead_encrypt k n m aad in
let mlen = length m in
let cipher, mac = Seq.slice enc 0 mlen, Seq.slice enc mlen (mlen + 16) in
let dec = aead_decrypt k n c_expected mac_expected aad in
IO.print_string "\n cipher:";
let res_c = PS.print_compare true mlen c_expected cipher in
IO.print_string "\n mac:";
let res_m = PS.print_compare true 16 mac_expected mac in
IO.print_string "\n plain:";
let res_p =
if Some? dec then PS.print_compare true mlen m (Some?.v dec)
else false in
let res = res_c && res_m && res_p in
if res then IO.print_string "\n Chacha20Poly1305 Test: Success!\n"
else IO.print_string "\n Chacha20Poly1305 Test: Failure :(\n";
res | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> FStar.All.ALL Prims.bool | FStar.All.ALL | [] | [] | [
"Prims.unit",
"Prims.bool",
"FStar.IO.print_string",
"Spec.Chacha20Poly1305.Test.test_aead",
"Spec.Chacha20Poly1305.Test.test_key",
"Spec.Chacha20Poly1305.Test.test_nonce",
"Spec.Chacha20Poly1305.Test.test_plaintext",
"Spec.Chacha20Poly1305.Test.test_aad",
"Spec.Chacha20Poly1305.Test.test_cipher",
"Spec.Chacha20Poly1305.Test.test_mac"
] | [] | false | true | false | false | false | let test () =
| let res = test_aead test_key test_nonce test_plaintext test_aad test_cipher test_mac in
if res
then
(IO.print_string "\nChacha20Poly1305: Success! \\o/ \n";
true)
else
(IO.print_string "\nChacha20Poly1305: Failure :(\n";
false) | false |
|
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_plaintext | val test_plaintext:lbytes 114 | val test_plaintext:lbytes 114 | let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 52,
"start_col": 0,
"start_line": 34
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 114 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_plaintext:lbytes 114 =
| let l =
List.Tot.map u8_from_UInt8
[
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy; 0x6euy; 0x64uy; 0x20uy; 0x47uy;
0x65uy; 0x6euy; 0x74uy; 0x6cuy; 0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy; 0x73uy; 0x20uy; 0x6fuy; 0x66uy;
0x20uy; 0x27uy; 0x39uy; 0x39uy; 0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy; 0x65uy; 0x72uy; 0x20uy; 0x79uy;
0x6fuy; 0x75uy; 0x20uy; 0x6fuy; 0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x74uy; 0x68uy; 0x65uy; 0x20uy;
0x66uy; 0x75uy; 0x74uy; 0x75uy; 0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy;
0x62uy; 0x65uy; 0x20uy; 0x69uy; 0x74uy; 0x2euy
]
in
assert_norm (List.Tot.length l == 114);
of_list l | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_aead | val test_aead:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64}
-> c_expected:bytes{length c_expected = length m}
-> mac_expected:tag ->
FStar.All.ML bool | val test_aead:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64}
-> c_expected:bytes{length c_expected = length m}
-> mac_expected:tag ->
FStar.All.ML bool | let test_aead k n m aad c_expected mac_expected =
let enc = aead_encrypt k n m aad in
let mlen = length m in
let cipher, mac = Seq.slice enc 0 mlen, Seq.slice enc mlen (mlen + 16) in
let dec = aead_decrypt k n c_expected mac_expected aad in
IO.print_string "\n cipher:";
let res_c = PS.print_compare true mlen c_expected cipher in
IO.print_string "\n mac:";
let res_m = PS.print_compare true 16 mac_expected mac in
IO.print_string "\n plain:";
let res_p =
if Some? dec then PS.print_compare true mlen m (Some?.v dec)
else false in
let res = res_c && res_m && res_p in
if res then IO.print_string "\n Chacha20Poly1305 Test: Success!\n"
else IO.print_string "\n Chacha20Poly1305 Test: Failure :(\n";
res | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 121,
"start_col": 0,
"start_line": 103
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_aad : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy;
0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_cipher : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0xd3uy; 0x1auy; 0x8duy; 0x34uy; 0x64uy; 0x8euy; 0x60uy; 0xdbuy;
0x7buy; 0x86uy; 0xafuy; 0xbcuy; 0x53uy; 0xefuy; 0x7euy; 0xc2uy;
0xa4uy; 0xaduy; 0xeduy; 0x51uy; 0x29uy; 0x6euy; 0x08uy; 0xfeuy;
0xa9uy; 0xe2uy; 0xb5uy; 0xa7uy; 0x36uy; 0xeeuy; 0x62uy; 0xd6uy;
0x3duy; 0xbeuy; 0xa4uy; 0x5euy; 0x8cuy; 0xa9uy; 0x67uy; 0x12uy;
0x82uy; 0xfauy; 0xfbuy; 0x69uy; 0xdauy; 0x92uy; 0x72uy; 0x8buy;
0x1auy; 0x71uy; 0xdeuy; 0x0auy; 0x9euy; 0x06uy; 0x0buy; 0x29uy;
0x05uy; 0xd6uy; 0xa5uy; 0xb6uy; 0x7euy; 0xcduy; 0x3buy; 0x36uy;
0x92uy; 0xdduy; 0xbduy; 0x7fuy; 0x2duy; 0x77uy; 0x8buy; 0x8cuy;
0x98uy; 0x03uy; 0xaeuy; 0xe3uy; 0x28uy; 0x09uy; 0x1buy; 0x58uy;
0xfauy; 0xb3uy; 0x24uy; 0xe4uy; 0xfauy; 0xd6uy; 0x75uy; 0x94uy;
0x55uy; 0x85uy; 0x80uy; 0x8buy; 0x48uy; 0x31uy; 0xd7uy; 0xbcuy;
0x3fuy; 0xf4uy; 0xdeuy; 0xf0uy; 0x8euy; 0x4buy; 0x7auy; 0x9duy;
0xe5uy; 0x76uy; 0xd2uy; 0x65uy; 0x86uy; 0xceuy; 0xc6uy; 0x4buy;
0x61uy; 0x16uy; ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_mac : lbytes 16 =
let l = List.Tot.map u8_from_UInt8 [
0x1auy; 0xe1uy; 0x0buy; 0x59uy; 0x4fuy; 0x09uy; 0xe2uy; 0x6auy;
0x7euy; 0x90uy; 0x2euy; 0xcbuy; 0xd0uy; 0x60uy; 0x06uy; 0x91uy ] in
assert_norm (List.Tot.length l == 16);
of_list l
#set-options "--ifuel 2"
val test_aead:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64}
-> c_expected:bytes{length c_expected = length m}
-> mac_expected:tag ->
FStar.All.ML bool | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k: Spec.Chacha20Poly1305.key ->
n: Spec.Chacha20Poly1305.nonce ->
m: Lib.ByteSequence.bytes{Lib.Sequence.length m <= Lib.IntTypes.max_size_t} ->
aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64} ->
c_expected: Lib.ByteSequence.bytes{Lib.Sequence.length c_expected = Lib.Sequence.length m} ->
mac_expected: Spec.Chacha20Poly1305.tag
-> FStar.All.ML Prims.bool | FStar.All.ML | [
"ml"
] | [] | [
"Spec.Chacha20Poly1305.key",
"Spec.Chacha20Poly1305.nonce",
"Lib.ByteSequence.bytes",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U64",
"Prims.op_Equality",
"Prims.nat",
"Spec.Chacha20Poly1305.tag",
"Lib.ByteSequence.lbytes",
"Prims.bool",
"Prims.unit",
"FStar.IO.print_string",
"Prims.op_AmpAmp",
"FStar.Pervasives.Native.uu___is_Some",
"Lib.PrintSequence.print_compare",
"FStar.Pervasives.Native.__proj__Some__item__v",
"FStar.Pervasives.Native.option",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Spec.Chacha20Poly1305.aead_decrypt",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Spec.Poly1305.size_block",
"Spec.Chacha20Poly1305.aead_encrypt"
] | [] | false | true | false | false | false | let test_aead k n m aad c_expected mac_expected =
| let enc = aead_encrypt k n m aad in
let mlen = length m in
let cipher, mac = Seq.slice enc 0 mlen, Seq.slice enc mlen (mlen + 16) in
let dec = aead_decrypt k n c_expected mac_expected aad in
IO.print_string "\n cipher:";
let res_c = PS.print_compare true mlen c_expected cipher in
IO.print_string "\n mac:";
let res_m = PS.print_compare true 16 mac_expected mac in
IO.print_string "\n plain:";
let res_p = if Some? dec then PS.print_compare true mlen m (Some?.v dec) else false in
let res = res_c && res_m && res_p in
if res
then IO.print_string "\n Chacha20Poly1305 Test: Success!\n"
else IO.print_string "\n Chacha20Poly1305 Test: Failure :(\n";
res | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.term_eq | val term_eq : _: FStar.Stubs.Reflection.Types.term -> _: FStar.Stubs.Reflection.Types.term
-> FStar.Tactics.Effect.Tac Prims.bool | let term_eq = FStar.Tactics.term_eq_old | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 51,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 | _: FStar.Stubs.Reflection.Types.term -> _: FStar.Stubs.Reflection.Types.term
-> FStar.Tactics.Effect.Tac Prims.bool | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Stubs.Tactics.V1.Builtins.term_eq_old"
] | [] | false | true | false | false | false | let term_eq =
| FStar.Tactics.term_eq_old | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.distribute_left_lemma | val distribute_left_lemma : a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 59,
"end_line": 63,
"start_col": 0,
"start_line": 60
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
/// | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Algebra.CommMonoid.cm",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult"
] | [] | false | false | false | true | true | let distribute_left_lemma (a: Type) (cm_add cm_mult: cm a) =
| let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x: a -> y: a -> z: a -> Lemma (x * (y + z) == x * y + x * z) | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.distribute_right_lemma | val distribute_right_lemma : a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 59,
"end_line": 68,
"start_col": 0,
"start_line": 65
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Algebra.CommMonoid.cm",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult"
] | [] | false | false | false | true | true | let distribute_right_lemma (a: Type) (cm_add cm_mult: cm a) =
| let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x: a -> y: a -> z: a -> Lemma ((x + y) * z == x * z + y * z) | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.mult_zero_l_lemma | val mult_zero_l_lemma : a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 58,
"end_line": 71,
"start_col": 0,
"start_line": 70
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> cm_mult: FStar.Algebra.CommMonoid.cm a -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Algebra.CommMonoid.cm",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | false | true | true | let mult_zero_l_lemma (a: Type) (cm_add cm_mult: cm a) =
| x: a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit) | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.norm_fully | val norm_fully : x: a -> a | let norm_fully (#a:Type) (x:a) = x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 107,
"start_col": 7,
"start_line": 107
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: a -> a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let norm_fully (#a: Type) (x: a) =
| x | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.add_opp_r_lemma | val add_opp_r_lemma : a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> opp: (_: a -> a) -> Type | let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 75,
"start_col": 0,
"start_line": 73
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> cm_add: FStar.Algebra.CommMonoid.cm a -> opp: (_: a -> a) -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Algebra.CommMonoid.cm",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult"
] | [] | false | false | false | true | true | let add_opp_r_lemma (a: Type) (cm_add: cm a) (opp: (a -> a)) =
| let ( + ) = cm_add.mult in
x: a -> Lemma (x + opp x == cm_add.unit) | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.varlist_insert | val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a | val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a | let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2 | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 245,
"start_col": 0,
"start_line": 243
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
l1: FStar.Tactics.CanonCommSemiring.varlist ->
s2: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.monom_insert",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [] | false | false | false | false | false | let varlist_insert #a r l1 s2 =
| let aone = r.cm_mult.unit in
monom_insert r aone l1 s2 | false |
Spec.Chacha20Poly1305.Test.fst | Spec.Chacha20Poly1305.Test.test_cipher | val test_cipher:lbytes 114 | val test_cipher:lbytes 114 | let test_cipher : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0xd3uy; 0x1auy; 0x8duy; 0x34uy; 0x64uy; 0x8euy; 0x60uy; 0xdbuy;
0x7buy; 0x86uy; 0xafuy; 0xbcuy; 0x53uy; 0xefuy; 0x7euy; 0xc2uy;
0xa4uy; 0xaduy; 0xeduy; 0x51uy; 0x29uy; 0x6euy; 0x08uy; 0xfeuy;
0xa9uy; 0xe2uy; 0xb5uy; 0xa7uy; 0x36uy; 0xeeuy; 0x62uy; 0xd6uy;
0x3duy; 0xbeuy; 0xa4uy; 0x5euy; 0x8cuy; 0xa9uy; 0x67uy; 0x12uy;
0x82uy; 0xfauy; 0xfbuy; 0x69uy; 0xdauy; 0x92uy; 0x72uy; 0x8buy;
0x1auy; 0x71uy; 0xdeuy; 0x0auy; 0x9euy; 0x06uy; 0x0buy; 0x29uy;
0x05uy; 0xd6uy; 0xa5uy; 0xb6uy; 0x7euy; 0xcduy; 0x3buy; 0x36uy;
0x92uy; 0xdduy; 0xbduy; 0x7fuy; 0x2duy; 0x77uy; 0x8buy; 0x8cuy;
0x98uy; 0x03uy; 0xaeuy; 0xe3uy; 0x28uy; 0x09uy; 0x1buy; 0x58uy;
0xfauy; 0xb3uy; 0x24uy; 0xe4uy; 0xfauy; 0xd6uy; 0x75uy; 0x94uy;
0x55uy; 0x85uy; 0x80uy; 0x8buy; 0x48uy; 0x31uy; 0xd7uy; 0xbcuy;
0x3fuy; 0xf4uy; 0xdeuy; 0xf0uy; 0x8euy; 0x4buy; 0x7auy; 0x9duy;
0xe5uy; 0x76uy; 0xd2uy; 0x65uy; 0x86uy; 0xceuy; 0xc6uy; 0x4buy;
0x61uy; 0x16uy; ] in
assert_norm (List.Tot.length l == 114);
of_list l | {
"file_name": "specs/tests/Spec.Chacha20Poly1305.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 81,
"start_col": 0,
"start_line": 63
} | module Spec.Chacha20Poly1305.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
open Spec.Chacha20Poly1305
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(* Tests: RFC7539 *)
let test_key : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy ] in
assert_norm (List.Tot.length l == 32);
of_list l
let test_nonce : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x00uy; 0x00uy; 0x00uy; 0x40uy; 0x41uy; 0x42uy; 0x43uy;
0x44uy; 0x45uy; 0x46uy; 0x47uy ] in
assert_norm (List.Tot.length l == 12);
of_list l
let test_plaintext : lbytes 114 =
let l = List.Tot.map u8_from_UInt8 [
0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
0x74uy; 0x2euy ] in
assert_norm (List.Tot.length l == 114);
of_list l
let test_aad : lbytes 12 =
let l = List.Tot.map u8_from_UInt8 [
0x50uy; 0x51uy; 0x52uy; 0x53uy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy;
0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy ] in
assert_norm (List.Tot.length l == 12);
of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.Test.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Chacha20Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 114 | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let test_cipher:lbytes 114 =
| let l =
List.Tot.map u8_from_UInt8
[
0xd3uy; 0x1auy; 0x8duy; 0x34uy; 0x64uy; 0x8euy; 0x60uy; 0xdbuy; 0x7buy; 0x86uy; 0xafuy; 0xbcuy;
0x53uy; 0xefuy; 0x7euy; 0xc2uy; 0xa4uy; 0xaduy; 0xeduy; 0x51uy; 0x29uy; 0x6euy; 0x08uy; 0xfeuy;
0xa9uy; 0xe2uy; 0xb5uy; 0xa7uy; 0x36uy; 0xeeuy; 0x62uy; 0xd6uy; 0x3duy; 0xbeuy; 0xa4uy; 0x5euy;
0x8cuy; 0xa9uy; 0x67uy; 0x12uy; 0x82uy; 0xfauy; 0xfbuy; 0x69uy; 0xdauy; 0x92uy; 0x72uy; 0x8buy;
0x1auy; 0x71uy; 0xdeuy; 0x0auy; 0x9euy; 0x06uy; 0x0buy; 0x29uy; 0x05uy; 0xd6uy; 0xa5uy; 0xb6uy;
0x7euy; 0xcduy; 0x3buy; 0x36uy; 0x92uy; 0xdduy; 0xbduy; 0x7fuy; 0x2duy; 0x77uy; 0x8buy; 0x8cuy;
0x98uy; 0x03uy; 0xaeuy; 0xe3uy; 0x28uy; 0x09uy; 0x1buy; 0x58uy; 0xfauy; 0xb3uy; 0x24uy; 0xe4uy;
0xfauy; 0xd6uy; 0x75uy; 0x94uy; 0x55uy; 0x85uy; 0x80uy; 0x8buy; 0x48uy; 0x31uy; 0xd7uy; 0xbcuy;
0x3fuy; 0xf4uy; 0xdeuy; 0xf0uy; 0x8euy; 0x4buy; 0x7auy; 0x9duy; 0xe5uy; 0x76uy; 0xd2uy; 0x65uy;
0x86uy; 0xceuy; 0xc6uy; 0x4buy; 0x61uy; 0x16uy
]
in
assert_norm (List.Tot.length l == 114);
of_list l | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.spolynomial_simplify | val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 357,
"start_col": 0,
"start_line": 355
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> p: FStar.Tactics.CanonCommSemiring.spolynomial a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.spolynomial",
"FStar.Tactics.CanonCommSemiring.canonical_sum_simplify",
"FStar.Tactics.CanonCommSemiring.spolynomial_normalize",
"FStar.Tactics.CanonCommSemiring.canonical_sum"
] | [] | false | false | false | false | false | let spolynomial_simplify #a r p =
| canonical_sum_simplify r (spolynomial_normalize r p) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.vmap | val vmap : a: Type -> Type | let vmap a = list (var * a) * a | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 371,
"start_col": 0,
"start_line": 371
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.tuple2",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.var"
] | [] | false | false | false | true | true | let vmap a =
| list (var * a) * a | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.update | val update (#a: Type) (x: var) (xa: a) (vm: vmap a) : vmap a | val update (#a: Type) (x: var) (xa: a) (vm: vmap a) : vmap a | let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 375,
"start_col": 0,
"start_line": 374
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Stubs.Reflection.V2.Data.var -> xa: a -> vm: FStar.Tactics.CanonCommSemiring.vmap a
-> FStar.Tactics.CanonCommSemiring.vmap a | Prims.Tot | [
"total"
] | [] | [
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Tactics.CanonCommSemiring.vmap",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Prims.Cons"
] | [] | false | false | false | true | false | let update (#a: Type) (x: var) (xa: a) (vm: vmap a) : vmap a =
| let l, y = vm in
(x, xa) :: l, y | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.interp_var | val interp_var : vm: FStar.Tactics.CanonCommSemiring.vmap a -> i: FStar.Tactics.CanonCommSemiring.index -> a | let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 15,
"end_line": 408,
"start_col": 0,
"start_line": 405
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 | vm: FStar.Tactics.CanonCommSemiring.vmap a -> i: FStar.Tactics.CanonCommSemiring.index -> a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.List.Tot.Base.assoc",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Pervasives.Native.fst",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.snd"
] | [] | false | false | false | true | false | let interp_var (#a: Type) (vm: vmap a) (i: index) =
| match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.quote_vm | val quote_vm (#a: Type) (ta: term) (quotea: (a -> Tac term)) (vm: vmap a) : Tac term | val quote_vm (#a: Type) (ta: term) (quotea: (a -> Tac term)) (vm: vmap a) : Tac term | let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)] | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 73,
"end_line": 396,
"start_col": 0,
"start_line": 387
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
ta: FStar.Tactics.NamedView.term ->
quotea: (_: a -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term) ->
vm: FStar.Tactics.CanonCommSemiring.vmap a
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"Prims.Cons",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Implicit",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.Native.tuple2",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.V2.Derived.mk_e_app",
"FStar.Tactics.CanonCommSemiring.quote_list",
"FStar.Pervasives.Native.fst",
"Prims.nat",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Const",
"FStar.Stubs.Reflection.V2.Data.C_Int"
] | [] | false | true | false | false | false | let quote_vm (#a: Type) (ta: term) (quotea: (a -> Tac term)) (vm: vmap a) : Tac term =
| let quote_map_entry (p: (nat * a)) : Tac term =
mk_app (`Mktuple2)
[
((`nat), Q_Implicit);
(ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)
]
in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2)
[(tylist, Q_Implicit); (ta, Q_Implicit); (tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)] | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.index | val index:eqtype | val index:eqtype | let index: eqtype = nat | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 109,
"start_col": 0,
"start_line": 109
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"Prims.nat"
] | [] | false | false | false | true | false | let index:eqtype =
| nat | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.mult_one_l | val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)] | val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)] | let mult_one_l #a r x =
r.cm_mult.identity x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 22,
"end_line": 470,
"start_col": 0,
"start_line": 469
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma (ensures CM?.mult (CR?.cm_mult r) (CM?.unit (CR?.cm_mult r)) x == x)
[SMTPat (CM?.mult (CR?.cm_mult r) (CM?.unit (CR?.cm_mult r)) x)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__identity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"Prims.unit"
] | [] | true | false | true | false | false | let mult_one_l #a r x =
| r.cm_mult.identity x | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.add_zero_l | val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)] | val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)] | let add_zero_l #a r x =
r.cm_add.identity x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 22,
"end_line": 494,
"start_col": 0,
"start_line": 493
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma (ensures CM?.mult (CR?.cm_add r) (CM?.unit (CR?.cm_add r)) x == x)
[SMTPat (CM?.mult (CR?.cm_add r) (CM?.unit (CR?.cm_add r)) x)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__identity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"Prims.unit"
] | [] | true | false | true | false | false | let add_zero_l #a r x =
| r.cm_add.identity x | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.distribute_right | val distribute_right (#a: Type) (r: cr a) : distribute_right_lemma a r.cm_add r.cm_mult | val distribute_right (#a: Type) (r: cr a) : distribute_right_lemma a r.cm_add r.cm_mult | let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 94,
"start_col": 0,
"start_line": 89
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a
-> FStar.Tactics.CanonCommSemiring.distribute_right_lemma a (CR?.cm_add r) (CR?.cm_mult r) | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"Prims.unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__distribute",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Tactics.CanonCommSemiring.distribute_right_lemma"
] | [] | false | false | false | false | false | let distribute_right (#a: Type) (r: cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
| fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.mult_zero_l | val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)] | val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)] | let mult_zero_l #a r x =
r.mult_zero_l x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 482,
"start_col": 0,
"start_line": 481
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma
(ensures CM?.mult (CR?.cm_mult r) (CM?.unit (CR?.cm_add r)) x == CM?.unit (CR?.cm_add r))
[SMTPat (CM?.mult (CR?.cm_mult r) (CM?.unit (CR?.cm_add r)) x)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__mult_zero_l",
"Prims.unit"
] | [] | true | false | true | false | false | let mult_zero_l #a r x =
| r.mult_zero_l x | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.canonical_sum_scalar | val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a | val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a | let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 256,
"start_col": 0,
"start_line": 251
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
c0: a ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.Cons_monom",
"FStar.Tactics.CanonCommSemiring.norm_fully",
"FStar.Tactics.CanonCommSemiring.canonical_sum_scalar",
"FStar.Tactics.CanonCommSemiring.Nil_monom",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [
"recursion"
] | false | false | false | true | false | let rec canonical_sum_scalar #a r c0 s =
| let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.monom_insert | val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a | val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a | let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 237,
"start_col": 0,
"start_line": 216
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
c1: a ->
l1: FStar.Tactics.CanonCommSemiring.varlist ->
s2: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"Prims.op_Equality",
"FStar.Tactics.CanonCommSemiring.Cons_monom",
"FStar.Tactics.CanonCommSemiring.norm_fully",
"Prims.bool",
"FStar.Tactics.CanonCommSemiring.varlist_lt",
"FStar.Tactics.CanonCommSemiring.monom_insert",
"FStar.Tactics.CanonCommSemiring.Cons_varlist",
"FStar.Tactics.CanonCommSemiring.Nil_monom",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add"
] | [
"recursion"
] | false | false | false | false | false | let rec monom_insert #a r c1 l1 s2 =
| let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else if varlist_lt l1 l2 then Cons_monom c1 l1 s2 else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else if varlist_lt l1 l2 then Cons_monom c1 l1 s2 else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom -> if c1 = aone then Cons_varlist l1 Nil_monom else Cons_monom c1 l1 Nil_monom | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.varlist_lt | val varlist_lt (x y: varlist) : bool | val varlist_lt (x y: varlist) : bool | let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 141,
"start_col": 0,
"start_line": 136
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Tactics.CanonCommSemiring.varlist -> y: FStar.Tactics.CanonCommSemiring.varlist
-> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Tactics.CanonCommSemiring.index",
"Prims.op_LessThan",
"Prims.bool",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Tactics.CanonCommSemiring.varlist_lt"
] | [
"recursion"
] | false | false | false | true | false | let rec varlist_lt (x y: varlist) : bool =
| match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys -> if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.canonical_sum_prod | val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a | val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a | let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1 | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 301,
"start_col": 0,
"start_line": 293
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
s1: FStar.Tactics.CanonCommSemiring.canonical_sum a ->
s2: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum_merge",
"FStar.Tactics.CanonCommSemiring.canonical_sum_scalar3",
"FStar.Tactics.CanonCommSemiring.canonical_sum_prod",
"FStar.Tactics.CanonCommSemiring.canonical_sum_scalar2"
] | [
"recursion"
] | false | false | false | false | false | let rec canonical_sum_prod #a r s1 s2 =
| match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2) (canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2) (canonical_sum_prod r t1 s2)
| Nil_monom -> s1 | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.vm_aux | val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1]) | val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1]) | let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1 | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 162,
"start_col": 0,
"start_line": 151
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
v1: FStar.Tactics.CanonCommSemiring.index ->
t1: FStar.Tactics.CanonCommSemiring.varlist ->
l2: FStar.Tactics.CanonCommSemiring.varlist
-> Prims.Tot FStar.Tactics.CanonCommSemiring.varlist | Prims.Tot | [
"total",
""
] | [
"varlist_merge",
"vm_aux"
] | [
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.varlist",
"Prims.op_LessThan",
"FStar.Tactics.CanonCommSemiring.Cons_var",
"FStar.Tactics.CanonCommSemiring.varlist_merge",
"Prims.bool",
"FStar.Tactics.CanonCommSemiring.vm_aux"
] | [
"mutual recursion"
] | false | false | false | true | false | let rec vm_aux v1 t1 l2 =
| match l2 with
| Cons_var v2 t2 ->
if v1 < v2 then Cons_var v1 (varlist_merge t1 l2) else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1 | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.canonical_sum_scalar3 | val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a | val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a | let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 286,
"start_col": 0,
"start_line": 277
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
c0: a ->
l0: FStar.Tactics.CanonCommSemiring.varlist ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.monom_insert",
"FStar.Tactics.CanonCommSemiring.norm_fully",
"FStar.Tactics.CanonCommSemiring.varlist_merge",
"FStar.Tactics.CanonCommSemiring.canonical_sum_scalar3",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [
"recursion"
] | false | false | false | false | false | let rec canonical_sum_scalar3 #a r c0 l0 s =
| let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t -> monom_insert r c0 (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.csm_aux | val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1]) | val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1]) | let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1 | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 209,
"start_col": 0,
"start_line": 181
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1]) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
c1: a ->
l1: FStar.Tactics.CanonCommSemiring.varlist ->
t1: FStar.Tactics.CanonCommSemiring.canonical_sum a ->
s2: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> Prims.Tot (FStar.Tactics.CanonCommSemiring.canonical_sum a) | Prims.Tot | [
"total",
""
] | [
"canonical_sum_merge",
"csm_aux"
] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"Prims.op_Equality",
"FStar.Tactics.CanonCommSemiring.Cons_monom",
"FStar.Tactics.CanonCommSemiring.norm_fully",
"FStar.Tactics.CanonCommSemiring.canonical_sum_merge",
"Prims.bool",
"FStar.Tactics.CanonCommSemiring.varlist_lt",
"FStar.Tactics.CanonCommSemiring.csm_aux",
"FStar.Tactics.CanonCommSemiring.Cons_varlist",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec csm_aux #a r c1 l1 t1 s2 =
| let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom -> Cons_monom c1 l1 t1 | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.ivl_aux | val ivl_aux (#a: Type) (r: cr a) (vm: vmap a) (x: index) (t: varlist) : Tot a (decreases t) | val ivl_aux (#a: Type) (r: cr a) (vm: vmap a) (x: index) (t: varlist) : Tot a (decreases t) | let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t') | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 66,
"end_line": 417,
"start_col": 0,
"start_line": 412
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
x: FStar.Tactics.CanonCommSemiring.index ->
t: FStar.Tactics.CanonCommSemiring.varlist
-> Prims.Tot a | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.interp_var",
"FStar.Tactics.CanonCommSemiring.ivl_aux",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [
"recursion"
] | false | false | false | true | false | let rec ivl_aux (#a: Type) (r: cr a) (vm: vmap a) (x: index) (t: varlist) : Tot a (decreases t) =
| let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t') | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.quote_list | val quote_list (#a: Type) (ta: term) (quotea: (a -> Tac term)) (xs: list a) : Tac term | val quote_list (#a: Type) (ta: term) (quotea: (a -> Tac term)) (xs: list a) : Tac term | let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)] | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 68,
"end_line": 384,
"start_col": 0,
"start_line": 378
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
ta: FStar.Tactics.NamedView.term ->
quotea: (_: a -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term) ->
xs: Prims.list a
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"Prims.list",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Implicit",
"Prims.Nil",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"FStar.Tactics.CanonCommSemiring.quote_list"
] | [
"recursion"
] | false | true | false | false | false | let rec quote_list (#a: Type) (ta: term) (quotea: (a -> Tac term)) (xs: list a) : Tac term =
| match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x :: xs' ->
mk_app (`Cons) [(ta, Q_Implicit); (quotea x, Q_Explicit); (quote_list ta quotea xs', Q_Explicit)] | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.interp_vl | val interp_vl : r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
l: FStar.Tactics.CanonCommSemiring.varlist
-> a | let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 424,
"start_col": 0,
"start_line": 420
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t') | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
l: FStar.Tactics.CanonCommSemiring.varlist
-> a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.ivl_aux",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [] | false | false | false | true | false | let interp_vl (#a: Type) (r: cr a) (vm: vmap a) (l: varlist) =
| let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t | false |
|
FStar.UInt16.fsti | FStar.UInt16.n | val n : Prims.int | let n = 16 | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 20,
"start_col": 7,
"start_line": 20
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.int | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let n =
| 16 | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.canonical_sum_scalar2 | val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a | val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a | let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 269,
"start_col": 0,
"start_line": 263
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
l0: FStar.Tactics.CanonCommSemiring.varlist ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.monom_insert",
"FStar.Tactics.CanonCommSemiring.varlist_merge",
"FStar.Tactics.CanonCommSemiring.canonical_sum_scalar2",
"FStar.Tactics.CanonCommSemiring.varlist_insert",
"FStar.Tactics.CanonCommSemiring.Nil_monom"
] | [
"recursion"
] | false | false | false | false | false | let rec canonical_sum_scalar2 #a r l0 s =
| match s with
| Cons_monom c l t -> monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t -> varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.canonical_sum_simplify | val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a | val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a | let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 346,
"start_col": 0,
"start_line": 334
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.norm_fully",
"Prims.bool",
"Prims.op_Equality",
"FStar.Tactics.CanonCommSemiring.canonical_sum_simplify",
"FStar.Tactics.CanonCommSemiring.Cons_varlist",
"FStar.Tactics.CanonCommSemiring.Cons_monom",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [
"recursion"
] | false | false | false | false | false | let rec canonical_sum_simplify #a r s =
| let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero)
then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.mult_one_r | val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)] | val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)] | let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 42,
"end_line": 476,
"start_col": 0,
"start_line": 475
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma (ensures CM?.mult (CR?.cm_mult r) x (CM?.unit (CR?.cm_mult r)) == x)
[SMTPat (CM?.mult (CR?.cm_mult r) x (CM?.unit (CR?.cm_mult r)))] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"Prims.unit"
] | [] | true | false | true | false | false | let mult_one_r #a r x =
| r.cm_mult.commutativity r.cm_mult.unit x | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.spolynomial_normalize | val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 80,
"end_line": 325,
"start_col": 0,
"start_line": 318
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> p: FStar.Tactics.CanonCommSemiring.spolynomial a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.spolynomial",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.Cons_varlist",
"FStar.Tactics.CanonCommSemiring.Cons_var",
"FStar.Tactics.CanonCommSemiring.Nil_var",
"FStar.Tactics.CanonCommSemiring.Nil_monom",
"FStar.Tactics.CanonCommSemiring.Cons_monom",
"FStar.Tactics.CanonCommSemiring.canonical_sum_merge",
"FStar.Tactics.CanonCommSemiring.spolynomial_normalize",
"FStar.Tactics.CanonCommSemiring.canonical_sum_prod",
"FStar.Tactics.CanonCommSemiring.canonical_sum"
] | [
"recursion"
] | false | false | false | false | false | let rec spolynomial_normalize #a r p =
| match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q -> canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q -> canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.interp_cs | val interp_cs (#a: Type) (r: cr a) (vm: vmap a) (s: canonical_sum a) : a | val interp_cs (#a: Type) (r: cr a) (vm: vmap a) (s: canonical_sum a) : a | let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 58,
"end_line": 449,
"start_col": 0,
"start_line": 444
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.ics_aux",
"FStar.Tactics.CanonCommSemiring.interp_vl",
"FStar.Tactics.CanonCommSemiring.interp_m",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add"
] | [] | false | false | false | true | false | let interp_cs (#a: Type) (r: cr a) (vm: vmap a) (s: canonical_sum a) : a =
| let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t | false |
FStar.UInt16.fsti | FStar.UInt16.gt | val gt (a b: t) : Tot bool | val gt (a b: t) : Tot bool | let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 226,
"start_col": 0,
"start_line": 226
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.gt",
"FStar.UInt16.n",
"FStar.UInt16.v",
"Prims.bool"
] | [] | false | false | false | true | false | let gt (a b: t) : Tot bool =
| gt #n (v a) (v b) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.mult_zero_r | val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)] | val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)] | let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 488,
"start_col": 0,
"start_line": 487
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma
(ensures CM?.mult (CR?.cm_mult r) x (CM?.unit (CR?.cm_add r)) == CM?.unit (CR?.cm_add r))
[SMTPat (CM?.mult (CR?.cm_mult r) x (CM?.unit (CR?.cm_add r)))] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"Prims.unit"
] | [] | true | false | true | false | false | let mult_zero_r #a r x =
| r.cm_mult.commutativity x r.cm_add.unit | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.ics_aux | val ics_aux (#a: Type) (r: cr a) (vm: vmap a) (x: a) (s: canonical_sum a) : Tot a (decreases s) | val ics_aux (#a: Type) (r: cr a) (vm: vmap a) (x: a) (s: canonical_sum a) : Tot a (decreases s) | let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 68,
"end_line": 440,
"start_col": 0,
"start_line": 434
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
x: a ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> Prims.Tot a | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.ics_aux",
"FStar.Tactics.CanonCommSemiring.interp_vl",
"FStar.Tactics.CanonCommSemiring.interp_m",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add"
] | [
"recursion"
] | false | false | false | true | false | let rec ics_aux (#a: Type) (r: cr a) (vm: vmap a) (x: a) (s: canonical_sum a) : Tot a (decreases s) =
| let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t) | false |
FStar.UInt16.fsti | FStar.UInt16.gte | val gte (a b: t) : Tot bool | val gte (a b: t) : Tot bool | let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 229,
"start_col": 0,
"start_line": 229
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.gte",
"FStar.UInt16.n",
"FStar.UInt16.v",
"Prims.bool"
] | [] | false | false | false | true | false | let gte (a b: t) : Tot bool =
| gte #n (v a) (v b) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.add_zero_r | val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)] | val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)] | let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 500,
"start_col": 0,
"start_line": 499
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma (ensures CM?.mult (CR?.cm_add r) x (CM?.unit (CR?.cm_add r)) == x)
[SMTPat (CM?.mult (CR?.cm_add r) x (CM?.unit (CR?.cm_add r)))] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"Prims.unit"
] | [] | true | false | true | false | false | let add_zero_r #a r x =
| r.cm_add.commutativity r.cm_add.unit x | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.polynomial_simplify | val polynomial_simplify: #a:eqtype -> cr a -> polynomial a -> canonical_sum a | val polynomial_simplify: #a:eqtype -> cr a -> polynomial a -> canonical_sum a | let polynomial_simplify #a r p =
canonical_sum_simplify r
(polynomial_normalize r p) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 1390,
"start_col": 0,
"start_line": 1388
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x)
let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
}
val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit)
let add_mult_opp #a r x =
let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc (==) {
x + r.opp one * x;
== { }
one * x + r.opp one * x;
== { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
== { r.add_opp one }
zero * x;
== { }
zero;
}
val ivl_aux_ok (#a:Type) (r:cr a) (vm:vmap a) (v:varlist) (i:index) : Lemma
(ivl_aux r vm i v == r.cm_mult.mult (interp_var vm i) (interp_vl r vm v))
let ivl_aux_ok #a r vm v i = ()
val vm_aux_ok (#a:eqtype) (r:cr a) (vm:vmap a) (v:index) (t l:varlist) :
Lemma
(ensures
interp_vl r vm (vm_aux v t l) ==
r.cm_mult.mult (interp_vl r vm (Cons_var v t)) (interp_vl r vm l))
(decreases %[t; l; 1])
val varlist_merge_ok (#a:eqtype) (r:cr a) (vm:vmap a) (x y:varlist) :
Lemma
(ensures
interp_vl r vm (varlist_merge x y) ==
r.cm_mult.mult (interp_vl r vm x) (interp_vl r vm y))
(decreases %[x; y; 0])
let rec varlist_merge_ok #a r vm x y =
let amult = r.cm_mult.mult in
match x, y with
| Cons_var v1 t1, Nil_var -> ()
| Cons_var v1 t1, Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 y;
assert (
interp_vl r vm (varlist_merge x y) ==
amult (interp_var vm v1) (amult (interp_vl r vm t1) (interp_vl r vm y)));
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm y)
end
else
vm_aux_ok r vm v1 t1 y
| Nil_var, _ -> ()
and vm_aux_ok #a r vm v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 l2;
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm l2)
end
else
begin
vm_aux_ok r vm v1 t1 t2;
calc (==) {
interp_vl r vm (Cons_var v2 (vm_aux v1 t1 t2));
== { }
ivl_aux r vm v2 (vm_aux v1 t1 t2);
== { }
r.cm_mult.mult (interp_var vm v2) (interp_vl r vm (vm_aux v1 t1 t2));
== { }
r.cm_mult.mult (interp_var vm v2) (r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2) }
r.cm_mult.mult (interp_var vm v2)
(r.cm_mult.mult (interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) );
== { r.cm_mult.associativity
(interp_var vm v2)
(interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) }
r.cm_mult.mult
(r.cm_mult.mult (interp_var vm v2) (interp_vl r vm t2))
(interp_vl r vm (Cons_var v1 t1));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2)) }
r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2));
}
end
| _ -> ()
val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s))
(decreases s)
let rec ics_aux_ok #a r vm x s =
match s with
| Nil_monom -> ()
| Cons_varlist l t ->
ics_aux_ok r vm (interp_vl r vm l) t
| Cons_monom c l t ->
ics_aux_ok r vm (interp_m r vm c l) t
val interp_m_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> l:varlist ->
Lemma (interp_m r vm x l == r.cm_mult.mult x (interp_vl r vm l))
let interp_m_ok #a r vm x l = ()
val aplus_assoc_4: #a:Type -> r:cr a -> w:a -> x:a -> y:a -> z:a -> Lemma
(let aplus = r.cm_add.mult in
aplus (aplus w x) (aplus y z) == aplus (aplus w y) (aplus x z))
let aplus_assoc_4 #a r w x y z =
let aplus = r.cm_add.mult in
let assoc = r.cm_add.associativity in
let comm = r.cm_add.commutativity in
calc (==) {
aplus (aplus w x) (aplus y z);
== { assoc w x (aplus y z) }
aplus w (aplus x (aplus y z));
== { comm x (aplus y z) }
aplus w (aplus (aplus y z) x);
== { assoc w (aplus y z) x }
aplus (aplus w (aplus y z)) x;
== { assoc w y z }
aplus (aplus (aplus w y) z) x;
== { assoc (aplus w y) z x }
aplus (aplus w y) (aplus z x);
== { comm z x }
aplus (aplus w y) (aplus x z);
}
val canonical_sum_merge_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> s1:canonical_sum a -> s2:canonical_sum a ->
Lemma
(ensures
interp_cs r vm (canonical_sum_merge r s1 s2) ==
r.cm_add.mult (interp_cs r vm s1) (interp_cs r vm s2))
(decreases %[s1; s2; 0])
val csm_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c1:a -> l1:varlist -> t1:canonical_sum a -> s2:canonical_sum a ->
Lemma
(ensures
interp_cs r vm (csm_aux r c1 l1 t1 s2) ==
r.cm_add.mult (interp_cs r vm (Cons_monom c1 l1 t1)) (interp_cs r vm s2))
(decreases %[t1; s2; 1])
let rec canonical_sum_merge_ok #a r vm s1 s2 =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux_ok #a r vm c1 l1 t1 s2
| Cons_varlist l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
interp_cs r vm (csm_aux r aone l1 t1 s2);
== { csm_aux_ok #a r vm aone l1 t1 s2 }
aplus (interp_cs r vm (Cons_monom aone l1 t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (interp_vl r vm l1) t1 }
aplus (interp_cs r vm (Cons_varlist l1 t1))
(interp_cs r vm s2);
}
| Nil_monom -> ()
and csm_aux_ok #a r vm c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
let amult = r.cm_mult.mult in
match s2 with
| Nil_monom -> ()
| Cons_monom c2 l2 t2 ->
let s1 = Cons_monom c1 l1 t1 in
if l1 = l2 then
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2);
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2) }
aplus (interp_m r vm (aplus c1 c2) l1)
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { canonical_sum_merge_ok r vm t1 t2 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm t2));
== { distribute_right r c1 c2 (interp_vl r vm l1) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(aplus (interp_cs r vm t1)
(interp_cs r vm t2));
== { aplus_assoc_4 r
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t1)
(interp_cs r vm t2) }
aplus (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1)
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c2 (interp_vl r vm l2)) t2;
interp_m_ok r vm c2 l2 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else if varlist_lt l1 l2 then
begin
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
ics_aux r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2);
== { ics_aux_ok r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2) }
aplus (interp_m r vm c1 l1)
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { interp_m_ok r vm c1 l1 }
aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { canonical_sum_merge_ok r vm t1 s2 }
aplus (amult c1 (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm s2));
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t1)
(interp_cs r vm s2)
}
aplus (aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2);
== { ics_aux_ok r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2) }
aplus (interp_m r vm c2 l2)
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { interp_m_ok r vm c2 l2 }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { csm_aux_ok r vm c1 l1 t1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm s1) (interp_cs r vm t2));
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2) (interp_cs r vm s1));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(interp_cs r vm s1)
}
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(interp_cs r vm s1);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s2) (interp_cs r vm s1);
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm s2) }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
| Cons_varlist l2 t2 -> // Same as Cons_monom with c2 = aone
let c2 = aone in
let s1 = Cons_monom c1 l1 t1 in
if l1 = l2 then
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2);
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2) }
aplus (interp_m r vm (aplus c1 c2) l1)
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { canonical_sum_merge_ok r vm t1 t2 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm t2));
== { distribute_right r c1 c2 (interp_vl r vm l1) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(aplus (interp_cs r vm t1)
(interp_cs r vm t2));
== { aplus_assoc_4 r
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t1)
(interp_cs r vm t2) }
aplus (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1)
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c2 (interp_vl r vm l2)) t2;
interp_m_ok r vm c2 l2 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else if varlist_lt l1 l2 then
begin
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
ics_aux r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2);
== { ics_aux_ok r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2) }
aplus (interp_m r vm c1 l1)
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { interp_m_ok r vm c1 l1 }
aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { canonical_sum_merge_ok r vm t1 s2 }
aplus (amult c1 (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm s2));
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t1)
(interp_cs r vm s2)
}
aplus (aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2);
== { ics_aux_ok r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2) }
aplus (interp_m r vm c2 l2)
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { interp_m_ok r vm c2 l2 }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { csm_aux_ok r vm c1 l1 t1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm s1) (interp_cs r vm t2));
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2) (interp_cs r vm s1));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(interp_cs r vm s1)
}
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(interp_cs r vm s1);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s2) (interp_cs r vm s1);
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm s2) }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
val monom_insert_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c1:a -> l1:varlist -> s2:canonical_sum a ->
Lemma
(interp_cs r vm (monom_insert r c1 l1 s2) ==
r.cm_add.mult (r.cm_mult.mult c1 (interp_vl r vm l1)) (interp_cs r vm s2))
let rec monom_insert_ok #a r vm c1 l1 s2 =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom (aplus c1 c2) l1 t2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1) t2;
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1) t2 }
aplus (interp_m r vm (aplus c1 c2) l1) (interp_cs r vm t2);
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l2)) (interp_cs r vm t2);
== { distribute_right r c1 c2 (interp_vl r vm l2) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(interp_cs r vm t2);
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2) }
aplus (amult c1 (interp_vl r vm l1))
(aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
else
if varlist_lt l1 l2 then ()
else
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom c2 l2 (monom_insert r c1 l1 t2));
== { }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (monom_insert r c1 l1 t2));
== { monom_insert_ok r vm c1 l1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t2));
== { r.cm_add.commutativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)) }
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(amult c1 (interp_vl r vm l1));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (interp_cs r vm s2) (amult c1 (interp_vl r vm l1));
== { r.cm_add.commutativity
(interp_cs r vm s2)
(amult c1 (interp_vl r vm l1)) }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
| Cons_varlist l2 t2 -> // Same as Cons_monom with c2 = aone
let c2 = aone in
if l1 = l2
then
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom (aplus c1 c2) l1 t2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1) t2;
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1) t2 }
aplus (interp_m r vm (aplus c1 c2) l1) (interp_cs r vm t2);
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l2)) (interp_cs r vm t2);
== { distribute_right r c1 c2 (interp_vl r vm l2) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(interp_cs r vm t2);
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2) }
aplus (amult c1 (interp_vl r vm l1))
(aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
else
if varlist_lt l1 l2 then ()
else
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom c2 l2 (monom_insert r c1 l1 t2));
== { }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (monom_insert r c1 l1 t2));
== { monom_insert_ok r vm c1 l1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t2));
== { r.cm_add.commutativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)) }
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(amult c1 (interp_vl r vm l1));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (interp_cs r vm s2) (amult c1 (interp_vl r vm l1));
== { r.cm_add.commutativity
(interp_cs r vm s2)
(amult c1 (interp_vl r vm l1)) }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
| Nil_monom -> ()
val varlist_insert_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> l1:varlist -> s2:canonical_sum a ->
Lemma (interp_cs r vm (varlist_insert r l1 s2) ==
r.cm_add.mult (interp_vl r vm l1) (interp_cs r vm s2))
let varlist_insert_ok #a r vm l1 s2 =
let aone = r.cm_mult.unit in
monom_insert_ok r vm aone l1 s2
val canonical_sum_scalar_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c0:a -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar r c0 s) ==
r.cm_mult.mult c0 (interp_cs r vm s))
let rec canonical_sum_scalar_ok #a r vm c0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar r c0 s);
== { }
interp_cs r vm (Cons_monom (amult c0 c) l (canonical_sum_scalar r c0 t));
== { }
aplus (amult (amult c0 c) (interp_vl r vm l))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { r.cm_mult.associativity c0 c (interp_vl r vm l) }
aplus (amult c0 (amult c (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { canonical_sum_scalar_ok r vm c0 t }
aplus (amult c0 (amult c (interp_vl r vm l)))
(amult c0 (interp_cs r vm t));
== { r.distribute c0 (amult c (interp_vl r vm l))
(interp_cs r vm t) }
amult c0 (aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult c0 (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = r.cm_mult.unit
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar r c0 s);
== { }
interp_cs r vm (Cons_monom (amult c0 c) l (canonical_sum_scalar r c0 t));
== { }
aplus (amult (amult c0 c) (interp_vl r vm l))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { r.cm_mult.associativity c0 c (interp_vl r vm l) }
aplus (amult c0 (amult c (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { canonical_sum_scalar_ok r vm c0 t }
aplus (amult c0 (amult c (interp_vl r vm l)))
(amult c0 (interp_cs r vm t));
== { r.distribute c0 (amult c (interp_vl r vm l))
(interp_cs r vm t) }
amult c0 (aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult c0 (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_scalar2_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> l0:varlist -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar2 r l0 s) ==
r.cm_mult.mult (interp_vl r vm l0) (interp_cs r vm s))
let rec canonical_sum_scalar2_ok #a r vm l0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar2 r l0 s);
== { }
interp_cs r vm
(monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t));
== { monom_insert_ok r vm c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t) }
aplus (amult c (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { canonical_sum_scalar2_ok r vm l0 t }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity c (interp_vl r vm l0)
(interp_vl r vm l) }
aplus (amult (amult c (interp_vl r vm l0)) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.commutativity (interp_vl r vm l0) c }
aplus (amult (amult (interp_vl r vm l0) c) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity (interp_vl r vm l0) c (interp_vl r vm l) }
aplus (amult (interp_vl r vm l0) (amult c (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.distribute (interp_vl r vm l0)
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (interp_vl r vm l0)
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (interp_vl r vm l0) (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = aone
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar2 r l0 s);
== { }
interp_cs r vm
(monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t));
== { monom_insert_ok r vm c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t) }
aplus (amult c (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { canonical_sum_scalar2_ok r vm l0 t }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity c (interp_vl r vm l0)
(interp_vl r vm l) }
aplus (amult (amult c (interp_vl r vm l0)) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.commutativity (interp_vl r vm l0) c }
aplus (amult (amult (interp_vl r vm l0) c) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity (interp_vl r vm l0) c (interp_vl r vm l) }
aplus (amult (interp_vl r vm l0) (amult c (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.distribute (interp_vl r vm l0)
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (interp_vl r vm l0)
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (interp_vl r vm l0) (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_scalar3_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c0:a -> l0:varlist -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s) ==
r.cm_mult.mult (r.cm_mult.mult c0 (interp_vl r vm l0)) (interp_cs r vm s))
let rec canonical_sum_scalar3_ok #a r vm c0 l0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s);
== { }
interp_cs r vm
(monom_insert r (amult c0 c) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t));
== { monom_insert_ok r vm (amult c0 c) (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t) }
aplus (amult (amult c0 c) (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { canonical_sum_scalar3_ok r vm c0 l0 t }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 c)
(interp_vl r vm l0) (interp_vl r vm l) }
aplus (amult (amult (amult c0 c) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c0 c }
aplus (amult (amult (amult c c0) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity c c0 (interp_vl r vm l0) }
aplus (amult (amult c (amult c0 (interp_vl r vm l0))) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c (amult c0 (interp_vl r vm l0)) }
aplus (amult (amult (amult c0 (interp_vl r vm l0)) c) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 (interp_vl r vm l0)) c (interp_vl r vm l) }
aplus (amult (amult c0 (interp_vl r vm l0)) (amult c (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.distribute (amult c0 (interp_vl r vm l0))
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (amult c0 (interp_vl r vm l0))
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = aone
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s);
== { }
interp_cs r vm
(monom_insert r (amult c0 c) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t));
== { monom_insert_ok r vm (amult c0 c) (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t) }
aplus (amult (amult c0 c) (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { canonical_sum_scalar3_ok r vm c0 l0 t }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 c)
(interp_vl r vm l0) (interp_vl r vm l) }
aplus (amult (amult (amult c0 c) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c0 c }
aplus (amult (amult (amult c c0) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity c c0 (interp_vl r vm l0) }
aplus (amult (amult c (amult c0 (interp_vl r vm l0))) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c (amult c0 (interp_vl r vm l0)) }
aplus (amult (amult (amult c0 (interp_vl r vm l0)) c) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 (interp_vl r vm l0)) c (interp_vl r vm l) }
aplus (amult (amult c0 (interp_vl r vm l0)) (amult c (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.distribute (amult c0 (interp_vl r vm l0))
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (amult c0 (interp_vl r vm l0))
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_prod_ok: #a:eqtype -> r:cr a -> vm:vmap a ->
s1:canonical_sum a -> s2:canonical_sum a ->
Lemma (interp_cs r vm (canonical_sum_prod r s1 s2) ==
r.cm_mult.mult (interp_cs r vm s1) (interp_cs r vm s2))
let rec canonical_sum_prod_ok #a r vm s1 s2 =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s1 with
| Cons_monom c1 l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_prod r s1 s2);
== { }
interp_cs r vm
(canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2));
== { canonical_sum_merge_ok r vm
(canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2) }
aplus (interp_cs r vm (canonical_sum_scalar3 r c1 l1 s2))
(interp_cs r vm (canonical_sum_prod r t1 s2));
== { canonical_sum_scalar3_ok r vm c1 l1 s2;
canonical_sum_prod_ok r vm t1 s2 }
aplus (amult (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2))
(amult (interp_cs r vm t1) (interp_cs r vm s2));
== { distribute_right r (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1) (interp_cs r vm s2) }
amult (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(interp_cs r vm s2);
== { }
amult (interp_cs r vm s1) (interp_cs r vm s2);
}
| Cons_varlist l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_prod r s1 s2);
== { }
interp_cs r vm
(canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2));
== { canonical_sum_merge_ok r vm
(canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2) }
aplus (interp_cs r vm (canonical_sum_scalar2 r l1 s2))
(interp_cs r vm (canonical_sum_prod r t1 s2));
== { canonical_sum_scalar2_ok r vm l1 s2;
canonical_sum_prod_ok r vm t1 s2 }
aplus (amult (interp_vl r vm l1) (interp_cs r vm s2))
(amult (interp_cs r vm t1) (interp_cs r vm s2));
== { distribute_right r (interp_vl r vm l1)
(interp_cs r vm t1) (interp_cs r vm s2) }
amult (aplus (interp_vl r vm l1) (interp_cs r vm t1))
(interp_cs r vm s2);
== { }
amult (interp_cs r vm s1) (interp_cs r vm s2);
}
| Nil_monom -> ()
val spolynomial_normalize_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:spolynomial a ->
Lemma (interp_cs r vm (spolynomial_normalize r p) == interp_sp r vm p)
let rec spolynomial_normalize_ok #a r vm p =
match p with
| SPvar _ -> ()
| SPconst _ -> ()
| SPplus l q ->
canonical_sum_merge_ok r vm
(spolynomial_normalize r l) (spolynomial_normalize r q);
spolynomial_normalize_ok r vm l;
spolynomial_normalize_ok r vm q
| SPmult l q ->
canonical_sum_prod_ok r vm
(spolynomial_normalize r l) (spolynomial_normalize r q);
spolynomial_normalize_ok r vm l;
spolynomial_normalize_ok r vm q
val canonical_sum_simplify_ok: #a:eqtype -> r:cr a -> vm:vmap a -> s:canonical_sum a ->
Lemma (interp_cs r vm (canonical_sum_simplify r s) == interp_cs r vm s)
let rec canonical_sum_simplify_ok #a r vm s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
match s with
| Cons_monom c _ t -> canonical_sum_simplify_ok r vm t
| Cons_varlist _ t -> canonical_sum_simplify_ok r vm t
| Nil_monom -> ()
val spolynomial_simplify_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:spolynomial a ->
Lemma (interp_cs r vm (spolynomial_simplify r p) == interp_sp r vm p)
let spolynomial_simplify_ok #a r vm p =
canonical_sum_simplify_ok r vm (spolynomial_normalize r p);
spolynomial_normalize_ok r vm p
(**
* This is the type where we first reflect expressions,
* before eliminating additive inverses
**)
type polynomial a =
| Pvar : index -> polynomial a
| Pconst : a -> polynomial a
| Pplus : polynomial a -> polynomial a -> polynomial a
| Pmult : polynomial a -> polynomial a -> polynomial a
| Popp : polynomial a -> polynomial a
(** Canonize a reflected expression *)
val polynomial_normalize: #a:eqtype -> cr a -> polynomial a -> canonical_sum a
[@@canon_attr]
let rec polynomial_normalize #a r p =
match p with
| Pvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| Pconst c -> Cons_monom c Nil_var Nil_monom
| Pplus l q ->
canonical_sum_merge r (polynomial_normalize r l) (polynomial_normalize r q)
| Pmult l q ->
canonical_sum_prod r (polynomial_normalize r l) (polynomial_normalize r q)
| Popp p ->
canonical_sum_scalar3 r (r.opp r.cm_mult.unit) Nil_var (polynomial_normalize r p)
val polynomial_simplify: #a:eqtype -> cr a -> polynomial a -> canonical_sum a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> p: FStar.Tactics.CanonCommSemiring.polynomial a
-> FStar.Tactics.CanonCommSemiring.canonical_sum a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.polynomial",
"FStar.Tactics.CanonCommSemiring.canonical_sum_simplify",
"FStar.Tactics.CanonCommSemiring.polynomial_normalize",
"FStar.Tactics.CanonCommSemiring.canonical_sum"
] | [] | false | false | false | false | false | let polynomial_simplify #a r p =
| canonical_sum_simplify r (polynomial_normalize r p) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.interp_m | val interp_m : r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
c: a ->
l: FStar.Tactics.CanonCommSemiring.varlist
-> a | let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 431,
"start_col": 0,
"start_line": 427
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
c: a ->
l: FStar.Tactics.CanonCommSemiring.varlist
-> a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.ivl_aux",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult"
] | [] | false | false | false | true | false | let interp_m (#a: Type) (r: cr a) (vm: vmap a) (c: a) (l: varlist) =
| let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t) | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.interp_sp | val interp_sp (#a: Type) (r: cr a) (vm: vmap a) (p: spolynomial a) : a | val interp_sp (#a: Type) (r: cr a) (vm: vmap a) (p: spolynomial a) : a | let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2) | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 65,
"end_line": 460,
"start_col": 0,
"start_line": 453
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
p: FStar.Tactics.CanonCommSemiring.spolynomial a
-> a | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.spolynomial",
"FStar.Tactics.CanonCommSemiring.index",
"FStar.Tactics.CanonCommSemiring.interp_var",
"FStar.Tactics.CanonCommSemiring.interp_sp",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add"
] | [
"recursion"
] | false | false | false | true | false | let rec interp_sp (#a: Type) (r: cr a) (vm: vmap a) (p: spolynomial a) : a =
| let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2) | false |
FStar.UInt16.fsti | FStar.UInt16.eq | val eq (a b: t) : Tot bool | val eq (a b: t) : Tot bool | let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 223,
"start_col": 0,
"start_line": 223
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.eq",
"FStar.UInt16.n",
"FStar.UInt16.v",
"Prims.bool"
] | [] | false | false | false | true | false | let eq (a b: t) : Tot bool =
| eq #n (v a) (v b) | false |
FStar.UInt16.fsti | FStar.UInt16.lt | val lt (a b: t) : Tot bool | val lt (a b: t) : Tot bool | let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 232,
"start_col": 0,
"start_line": 232
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.lt",
"FStar.UInt16.n",
"FStar.UInt16.v",
"Prims.bool"
] | [] | false | false | false | true | false | let lt (a b: t) : Tot bool =
| lt #n (v a) (v b) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.aplus_assoc_4 | val aplus_assoc_4: #a:Type -> r:cr a -> w:a -> x:a -> y:a -> z:a -> Lemma
(let aplus = r.cm_add.mult in
aplus (aplus w x) (aplus y z) == aplus (aplus w y) (aplus x z)) | val aplus_assoc_4: #a:Type -> r:cr a -> w:a -> x:a -> y:a -> z:a -> Lemma
(let aplus = r.cm_add.mult in
aplus (aplus w x) (aplus y z) == aplus (aplus w y) (aplus x z)) | let aplus_assoc_4 #a r w x y z =
let aplus = r.cm_add.mult in
let assoc = r.cm_add.associativity in
let comm = r.cm_add.commutativity in
calc (==) {
aplus (aplus w x) (aplus y z);
== { assoc w x (aplus y z) }
aplus w (aplus x (aplus y z));
== { comm x (aplus y z) }
aplus w (aplus (aplus y z) x);
== { assoc w (aplus y z) x }
aplus (aplus w (aplus y z)) x;
== { assoc w y z }
aplus (aplus (aplus w y) z) x;
== { assoc (aplus w y) z x }
aplus (aplus w y) (aplus z x);
== { comm z x }
aplus (aplus w y) (aplus x z);
} | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 649,
"start_col": 0,
"start_line": 631
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x)
let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
}
val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit)
let add_mult_opp #a r x =
let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc (==) {
x + r.opp one * x;
== { }
one * x + r.opp one * x;
== { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
== { r.add_opp one }
zero * x;
== { }
zero;
}
val ivl_aux_ok (#a:Type) (r:cr a) (vm:vmap a) (v:varlist) (i:index) : Lemma
(ivl_aux r vm i v == r.cm_mult.mult (interp_var vm i) (interp_vl r vm v))
let ivl_aux_ok #a r vm v i = ()
val vm_aux_ok (#a:eqtype) (r:cr a) (vm:vmap a) (v:index) (t l:varlist) :
Lemma
(ensures
interp_vl r vm (vm_aux v t l) ==
r.cm_mult.mult (interp_vl r vm (Cons_var v t)) (interp_vl r vm l))
(decreases %[t; l; 1])
val varlist_merge_ok (#a:eqtype) (r:cr a) (vm:vmap a) (x y:varlist) :
Lemma
(ensures
interp_vl r vm (varlist_merge x y) ==
r.cm_mult.mult (interp_vl r vm x) (interp_vl r vm y))
(decreases %[x; y; 0])
let rec varlist_merge_ok #a r vm x y =
let amult = r.cm_mult.mult in
match x, y with
| Cons_var v1 t1, Nil_var -> ()
| Cons_var v1 t1, Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 y;
assert (
interp_vl r vm (varlist_merge x y) ==
amult (interp_var vm v1) (amult (interp_vl r vm t1) (interp_vl r vm y)));
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm y)
end
else
vm_aux_ok r vm v1 t1 y
| Nil_var, _ -> ()
and vm_aux_ok #a r vm v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 l2;
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm l2)
end
else
begin
vm_aux_ok r vm v1 t1 t2;
calc (==) {
interp_vl r vm (Cons_var v2 (vm_aux v1 t1 t2));
== { }
ivl_aux r vm v2 (vm_aux v1 t1 t2);
== { }
r.cm_mult.mult (interp_var vm v2) (interp_vl r vm (vm_aux v1 t1 t2));
== { }
r.cm_mult.mult (interp_var vm v2) (r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2) }
r.cm_mult.mult (interp_var vm v2)
(r.cm_mult.mult (interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) );
== { r.cm_mult.associativity
(interp_var vm v2)
(interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) }
r.cm_mult.mult
(r.cm_mult.mult (interp_var vm v2) (interp_vl r vm t2))
(interp_vl r vm (Cons_var v1 t1));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2)) }
r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2));
}
end
| _ -> ()
val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s))
(decreases s)
let rec ics_aux_ok #a r vm x s =
match s with
| Nil_monom -> ()
| Cons_varlist l t ->
ics_aux_ok r vm (interp_vl r vm l) t
| Cons_monom c l t ->
ics_aux_ok r vm (interp_m r vm c l) t
val interp_m_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> l:varlist ->
Lemma (interp_m r vm x l == r.cm_mult.mult x (interp_vl r vm l))
let interp_m_ok #a r vm x l = ()
val aplus_assoc_4: #a:Type -> r:cr a -> w:a -> x:a -> y:a -> z:a -> Lemma
(let aplus = r.cm_add.mult in | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> w: a -> x: a -> y: a -> z: a
-> FStar.Pervasives.Lemma
(ensures
(let aplus = CM?.mult (CR?.cm_add r) in
aplus (aplus w x) (aplus y z) == aplus (aplus w y) (aplus x z))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Calc.calc_finish",
"Prims.eq2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"Prims.l_True",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Pervasives.pattern",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Algebra.CommMonoid.__proj__CM__item__associativity"
] | [] | false | false | true | false | false | let aplus_assoc_4 #a r w x y z =
| let aplus = r.cm_add.mult in
let assoc = r.cm_add.associativity in
let comm = r.cm_add.commutativity in
calc ( == ) {
aplus (aplus w x) (aplus y z);
( == ) { assoc w x (aplus y z) }
aplus w (aplus x (aplus y z));
( == ) { comm x (aplus y z) }
aplus w (aplus (aplus y z) x);
( == ) { assoc w (aplus y z) x }
aplus (aplus w (aplus y z)) x;
( == ) { assoc w y z }
aplus (aplus (aplus w y) z) x;
( == ) { assoc (aplus w y) z x }
aplus (aplus w y) (aplus z x);
( == ) { comm z x }
aplus (aplus w y) (aplus x z);
} | false |
FStar.UInt16.fsti | FStar.UInt16.lte | val lte (a b: t) : Tot bool | val lte (a b: t) : Tot bool | let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 235,
"start_col": 0,
"start_line": 235
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.lte",
"FStar.UInt16.n",
"FStar.UInt16.v",
"Prims.bool"
] | [] | false | false | false | true | false | let lte (a b: t) : Tot bool =
| lte #n (v a) (v b) | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.ics_aux_ok | val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s))
(decreases s) | val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s))
(decreases s) | let rec ics_aux_ok #a r vm x s =
match s with
| Nil_monom -> ()
| Cons_varlist l t ->
ics_aux_ok r vm (interp_vl r vm l) t
| Cons_monom c l t ->
ics_aux_ok r vm (interp_m r vm c l) t | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 622,
"start_col": 0,
"start_line": 616
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x)
let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
}
val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit)
let add_mult_opp #a r x =
let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc (==) {
x + r.opp one * x;
== { }
one * x + r.opp one * x;
== { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
== { r.add_opp one }
zero * x;
== { }
zero;
}
val ivl_aux_ok (#a:Type) (r:cr a) (vm:vmap a) (v:varlist) (i:index) : Lemma
(ivl_aux r vm i v == r.cm_mult.mult (interp_var vm i) (interp_vl r vm v))
let ivl_aux_ok #a r vm v i = ()
val vm_aux_ok (#a:eqtype) (r:cr a) (vm:vmap a) (v:index) (t l:varlist) :
Lemma
(ensures
interp_vl r vm (vm_aux v t l) ==
r.cm_mult.mult (interp_vl r vm (Cons_var v t)) (interp_vl r vm l))
(decreases %[t; l; 1])
val varlist_merge_ok (#a:eqtype) (r:cr a) (vm:vmap a) (x y:varlist) :
Lemma
(ensures
interp_vl r vm (varlist_merge x y) ==
r.cm_mult.mult (interp_vl r vm x) (interp_vl r vm y))
(decreases %[x; y; 0])
let rec varlist_merge_ok #a r vm x y =
let amult = r.cm_mult.mult in
match x, y with
| Cons_var v1 t1, Nil_var -> ()
| Cons_var v1 t1, Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 y;
assert (
interp_vl r vm (varlist_merge x y) ==
amult (interp_var vm v1) (amult (interp_vl r vm t1) (interp_vl r vm y)));
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm y)
end
else
vm_aux_ok r vm v1 t1 y
| Nil_var, _ -> ()
and vm_aux_ok #a r vm v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 l2;
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm l2)
end
else
begin
vm_aux_ok r vm v1 t1 t2;
calc (==) {
interp_vl r vm (Cons_var v2 (vm_aux v1 t1 t2));
== { }
ivl_aux r vm v2 (vm_aux v1 t1 t2);
== { }
r.cm_mult.mult (interp_var vm v2) (interp_vl r vm (vm_aux v1 t1 t2));
== { }
r.cm_mult.mult (interp_var vm v2) (r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2) }
r.cm_mult.mult (interp_var vm v2)
(r.cm_mult.mult (interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) );
== { r.cm_mult.associativity
(interp_var vm v2)
(interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) }
r.cm_mult.mult
(r.cm_mult.mult (interp_var vm v2) (interp_vl r vm t2))
(interp_vl r vm (Cons_var v1 t1));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2)) }
r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2));
}
end
| _ -> ()
val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Tactics.CanonCommSemiring.cr a ->
vm: FStar.Tactics.CanonCommSemiring.vmap a ->
x: a ->
s: FStar.Tactics.CanonCommSemiring.canonical_sum a
-> FStar.Pervasives.Lemma
(ensures
FStar.Tactics.CanonCommSemiring.ics_aux r vm x s ==
CM?.mult (CR?.cm_add r) x (FStar.Tactics.CanonCommSemiring.interp_cs r vm s)) (decreases s) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Prims.eqtype",
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Tactics.CanonCommSemiring.vmap",
"FStar.Tactics.CanonCommSemiring.canonical_sum",
"FStar.Tactics.CanonCommSemiring.varlist",
"FStar.Tactics.CanonCommSemiring.ics_aux_ok",
"FStar.Tactics.CanonCommSemiring.interp_vl",
"FStar.Tactics.CanonCommSemiring.interp_m",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec ics_aux_ok #a r vm x s =
| match s with
| Nil_monom -> ()
| Cons_varlist l t -> ics_aux_ok r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux_ok r vm (interp_m r vm c l) t | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.opp_unique | val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x) | val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x) | let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
} | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 518,
"start_col": 0,
"start_line": 505
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a -> y: a
-> FStar.Pervasives.Lemma (requires CM?.mult (CR?.cm_add r) x y == CM?.unit (CR?.cm_add r))
(ensures y == CR?.opp r x) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Calc.calc_finish",
"Prims.eq2",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__opp",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__add_opp",
"Prims.squash",
"FStar.Algebra.CommMonoid.__proj__CM__item__associativity",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Algebra.CommMonoid.__proj__CM__item__commutativity",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult"
] | [] | false | false | true | false | false | let opp_unique #a r x y =
| let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc ( == ) {
y;
( == ) { r.add_opp x }
y + (x + r.opp x);
( == ) { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
( == ) { r.cm_add.commutativity x y }
zero + r.opp x;
( == ) { () }
r.opp x;
} | false |
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.add_mult_opp | val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit) | val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit) | let add_mult_opp #a r x =
let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc (==) {
x + r.opp one * x;
== { }
one * x + r.opp one * x;
== { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
== { r.add_opp one }
zero * x;
== { }
zero;
} | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 537,
"start_col": 0,
"start_line": 522
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x)
let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
}
val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Tactics.CanonCommSemiring.cr a -> x: a
-> FStar.Pervasives.Lemma
(ensures
CM?.mult (CR?.cm_add r) x (CM?.mult (CR?.cm_mult r) (CR?.opp r (CM?.unit (CR?.cm_mult r))) x) ==
CM?.unit (CR?.cm_add r)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Tactics.CanonCommSemiring.cr",
"FStar.Calc.calc_finish",
"Prims.eq2",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__opp",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"FStar.Tactics.CanonCommSemiring.distribute_right",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__add_opp",
"FStar.Algebra.CommMonoid.__proj__CM__item__unit",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_mult",
"FStar.Tactics.CanonCommSemiring.__proj__CR__item__cm_add",
"FStar.Algebra.CommMonoid.__proj__CM__item__mult"
] | [] | false | false | true | false | false | let add_mult_opp #a r x =
| let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc ( == ) {
x + r.opp one * x;
( == ) { () }
one * x + r.opp one * x;
( == ) { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
( == ) { r.add_opp one }
zero * x;
( == ) { () }
zero;
} | false |
FStar.UInt16.fsti | FStar.UInt16.op_Plus_Percent_Hat | val op_Plus_Percent_Hat : a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | let op_Plus_Percent_Hat = add_mod | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 318,
"start_col": 7,
"start_line": 318
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an UInt32. *)
inline_for_extraction
let n_minus_one = UInt32.uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.add_mod"
] | [] | false | false | false | false | false | let op_Plus_Percent_Hat =
| add_mod | false |
|
FStar.UInt16.fsti | FStar.UInt16.op_Subtraction_Percent_Hat | val op_Subtraction_Percent_Hat : a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | let op_Subtraction_Percent_Hat = sub_mod | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 321,
"start_col": 7,
"start_line": 321
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an UInt32. *)
inline_for_extraction
let n_minus_one = UInt32.uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.sub_mod"
] | [] | false | false | false | false | false | let op_Subtraction_Percent_Hat =
| sub_mod | false |
|
FStar.UInt16.fsti | FStar.UInt16.op_Subtraction_Hat | val op_Subtraction_Hat : a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | let op_Subtraction_Hat = sub | {
"file_name": "ulib/FStar.UInt16.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 319,
"start_col": 7,
"start_line": 319
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 16
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum shift value for this type, i.e. its width minus one,
as an UInt32. *)
inline_for_extraction
let n_minus_one = UInt32.uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt16.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.sub"
] | [] | false | false | false | false | false | let op_Subtraction_Hat =
| sub | false |
|
FStar.Tactics.CanonCommSemiring.fst | FStar.Tactics.CanonCommSemiring.find | val find : x: FStar.Tactics.NamedView.term -> xs: Prims.list FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac (FStar.Pervasives.Native.option Prims.nat) | let find = find_aux 0 | {
"file_name": "ulib/FStar.Tactics.CanonCommSemiring.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 1509,
"start_col": 0,
"start_line": 1509
} | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.CanonCommSemiring
/// A tactic to solve equalities on a commutative semiring (a, +, *, 0, 1)
///
/// The tactic [canon_semiring] is parameterized by the base type [a] and
/// a semiring theory [cr a]. This requires:
///
/// - A commutative monoid (a, +, 0) for addition
/// That is, + is associative, commutative and has identity element 0
/// - An additive inverse operator for (a, +, 0), making it an Abelian group
/// That is, a + -a = 0
/// - A commutative monoid (a, *, 1) for multiplication
/// That is, * is associative, commutative and has identity element 1
/// - Multiplication left-distributes over addition
/// That is, a * (b + c) == a * b + a * c
/// - 0 is an absorbing element of multiplication
/// That is, 0 * a = 0
///
/// In contrast to the previous version of FStar.Tactics.CanonCommSemiring,
/// the tactic defined here canonizes products, additions and additive inverses,
/// collects coefficients in monomials, and eliminates trivial expressions.
///
/// This is based on the legacy (second) version of Coq's ring tactic:
/// - https://github.com/coq-contribs/legacy-ring/
///
/// See also the newest ring tactic in Coq, which is even more general
/// and efficient:
/// - https://coq.inria.fr/refman/addendum/ring.html
/// - http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf
open FStar.List
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Algebra.CommMonoid
let term_eq = FStar.Tactics.term_eq_old
(** An attribute for marking definitions to unfold by the tactic *)
irreducible let canon_attr = ()
///
/// Commutative semiring theory
///
let distribute_left_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma (x * (y + z) == x * y + x * z)
let distribute_right_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
let ( + ) = cm_add.mult in
let ( * ) = cm_mult.mult in
x:a -> y:a -> z:a -> Lemma ((x + y) * z == x * z + y * z)
let mult_zero_l_lemma (a:Type) (cm_add:cm a) (cm_mult:cm a) =
x:a -> Lemma (cm_mult.mult cm_add.unit x == cm_add.unit)
let add_opp_r_lemma (a:Type) (cm_add:cm a) (opp:(a -> a)) =
let ( + ) = cm_add.mult in
x:a -> Lemma (x + opp x == cm_add.unit)
[@@canon_attr]
unopteq
type cr (a:Type) =
| CR :
cm_add: cm a ->
cm_mult: cm a ->
opp: (a -> a) ->
add_opp: add_opp_r_lemma a cm_add opp ->
distribute: distribute_left_lemma a cm_add cm_mult ->
mult_zero_l: mult_zero_l_lemma a cm_add cm_mult ->
cr a
let distribute_right (#a:Type) (r:cr a) : distribute_right_lemma a r.cm_add r.cm_mult =
fun x y z ->
r.cm_mult.commutativity (r.cm_add.mult x y) z;
r.distribute z x y;
r.cm_mult.commutativity x z;
r.cm_mult.commutativity y z
///
/// Syntax of canonical ring expressions
///
(**
* Marking expressions we would like to normalize fully.
* This does not do anything at the moment, but it would be nice
* to have a cheap mechanism to make this work without traversing the
* whole goal.
**)
[@@canon_attr]
unfold let norm_fully (#a:Type) (x:a) = x
let index: eqtype = nat
(*
* A list of variables represents a sorted product of one or more variables.
* We do not need to prove sortedness to prove correctness, so we never
* make it explicit.
*)
type varlist =
| Nil_var : varlist
| Cons_var : index -> varlist -> varlist
(*
* A canonical expression represents an ordered sum of monomials.
* Each monomial is either:
* - a varlist (a product of variables): x1 * ... * xk
* - a product of a scalar and a varlist: c * x1 * ... * xk
*
* The order on monomials is the lexicographic order on varlist, with the
* additional convention that monomials with a scalar are less than monomials
* without a scalar.
*)
type canonical_sum a =
| Nil_monom : canonical_sum a
| Cons_monom : a -> varlist -> canonical_sum a -> canonical_sum a
| Cons_varlist : varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec varlist_lt (x y:varlist) : bool =
match x, y with
| Nil_var, Cons_var _ _ -> true
| Cons_var i xs, Cons_var j ys ->
if i < j then true else i = j && varlist_lt xs ys
| _, _ -> false
[@@canon_attr]
val varlist_merge: l1:varlist -> l2:varlist -> Tot varlist (decreases %[l1; l2; 0])
[@@canon_attr]
val vm_aux: index -> t1:varlist -> l2:varlist -> Tot varlist (decreases %[t1; l2; 1])
(* Merges two lists of variables, preserving sortedness *)
[@@canon_attr]
let rec varlist_merge l1 l2 =
match l1, l2 with
| _, Nil_var -> l1
| Nil_var, _ -> l2
| Cons_var v1 t1, Cons_var v2 t2 -> vm_aux v1 t1 l2
and vm_aux v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then Cons_var v1 (varlist_merge t1 l2)
else Cons_var v2 (vm_aux v1 t1 t2)
| _ -> Cons_var v1 t1
(*
* Merges two canonical expressions
*
* We require that [a] is eqtype for better reasons later.
* Here it is convenient to fix the universe of [a] in
* mutually recursive functions.
*)
[@@canon_attr]
val canonical_sum_merge : #a:eqtype -> cr a
-> s1:canonical_sum a -> s2:canonical_sum a
-> Tot (canonical_sum a) (decreases %[s1; s2; 0])
[@@canon_attr]
val csm_aux: #a:eqtype -> r:cr a -> c1:a -> l1:varlist -> t1:canonical_sum a
-> s2:canonical_sum a -> Tot (canonical_sum a) (decreases %[t1; s2; 1])
[@@canon_attr]
let rec canonical_sum_merge #a r s1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux r c1 l1 t1 s2
| Cons_varlist l1 t1 -> csm_aux r aone l1 t1 s2
| Nil_monom -> s2
and csm_aux #a r c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_monom c2 l2 (csm_aux #a r c1 l1 t1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 (canonical_sum_merge r t1 t2)
else
if varlist_lt l1 l2
then Cons_monom c1 l1 (canonical_sum_merge r t1 s2)
else Cons_varlist l2 (csm_aux r c1 l1 t1 t2)
| Nil_monom ->
//if c1 = aone then Cons_varlist l1 t1 else
Cons_monom c1 l1 t1
(* Inserts a monomial into the appropriate position in a canonical sum *)
val monom_insert: #a:eqtype -> r:cr a
-> c1:a -> l1:varlist -> s2:canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec monom_insert #a r c1 l1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 c2)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_monom c2 l2 (monom_insert r c1 l1 t2)
| Cons_varlist l2 t2 ->
if l1 = l2
then Cons_monom (norm_fully (aplus c1 aone)) l1 t2
else
if varlist_lt l1 l2
then Cons_monom c1 l1 s2
else Cons_varlist l2 (monom_insert r c1 l1 t2)
| Nil_monom ->
if c1 = aone
then Cons_varlist l1 Nil_monom
else Cons_monom c1 l1 Nil_monom
(* Inserts a monomial without scalar into a canonical sum *)
val varlist_insert: #a:eqtype -> cr a -> varlist -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let varlist_insert #a r l1 s2 =
let aone = r.cm_mult.unit in
monom_insert r aone l1 s2
(* Multiplies a sum by a scalar c0 *)
val canonical_sum_scalar: #a:Type -> cr a -> a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar #a r c0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t -> Cons_monom (norm_fully (amult c0 c)) l (canonical_sum_scalar r c0 t)
| Cons_varlist l t -> Cons_monom c0 l (canonical_sum_scalar r c0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial without scalar *)
val canonical_sum_scalar2: #a:eqtype -> cr a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar2 #a r l0 s =
match s with
| Cons_monom c l t ->
monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Cons_varlist l t ->
varlist_insert r (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t)
| Nil_monom -> Nil_monom
(* Multiplies a sum by a monomial with scalar *)
val canonical_sum_scalar3: #a:eqtype -> cr a -> a -> varlist
-> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_scalar3 #a r c0 l0 s =
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
monom_insert r (norm_fully (amult c0 c)) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Cons_varlist l t ->
monom_insert r c0 (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t)
| Nil_monom -> s
(* Multiplies two canonical sums *)
val canonical_sum_prod: #a:eqtype -> cr a
-> canonical_sum a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_prod #a r s1 s2 =
match s1 with
| Cons_monom c1 l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2)
| Cons_varlist l1 t1 ->
canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2)
| Nil_monom -> s1
///
/// Syntax of concrete semiring polynomials
///
(* This is the type where we reflect expressions before normalization *)
type spolynomial a =
| SPvar : index -> spolynomial a
| SPconst : a -> spolynomial a
| SPplus : spolynomial a -> spolynomial a -> spolynomial a
| SPmult : spolynomial a -> spolynomial a -> spolynomial a
(** Canonize a reflected expression *)
val spolynomial_normalize: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let rec spolynomial_normalize #a r p =
match p with
| SPvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| SPconst c -> Cons_monom c Nil_var Nil_monom
| SPplus l q ->
canonical_sum_merge r (spolynomial_normalize r l) (spolynomial_normalize r q)
| SPmult l q ->
canonical_sum_prod r (spolynomial_normalize r l) (spolynomial_normalize r q)
(**
* Simplify a canonical sum.
* Removes 0 * x1 * ... * xk and turns 1 * x1 * ... * xk into x1 * ... * xk
**)
val canonical_sum_simplify: #a:eqtype -> cr a -> canonical_sum a -> canonical_sum a
[@@canon_attr]
let rec canonical_sum_simplify #a r s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
match s with
| Cons_monom c l t ->
if norm_fully (c = azero) then canonical_sum_simplify r t
else
if norm_fully (c = aone)
then Cons_varlist l (canonical_sum_simplify r t)
else Cons_monom c l (canonical_sum_simplify r t)
| Cons_varlist l t -> Cons_varlist l (canonical_sum_simplify r t)
| Nil_monom -> s
(**
* The main canonization algorithm: turn an expression into a sum and
* simplify it.
**)
val spolynomial_simplify: #a:eqtype -> cr a -> spolynomial a -> canonical_sum a
[@@canon_attr]
let spolynomial_simplify #a r p =
canonical_sum_simplify r
(spolynomial_normalize r p)
///
/// Interpretation of varlists, monomials and canonical sums
///
(**
* The variable map:
* This maps polynomial variables to ring expressions. That is, any term
* that is not an addition or a multiplication is turned into a variable
*
* The representation is inefficient. For large terms it might be worthwhile
* using a better data structure.
**)
let vmap a = list (var * a) * a
(** Add a new entry in a variable map *)
let update (#a:Type) (x:var) (xa:a) (vm:vmap a) : vmap a =
let l, y = vm in (x, xa) :: l, y
(** Quotes a list *)
let rec quote_list (#a:Type) (ta:term) (quotea:a -> Tac term) (xs:list a) :
Tac term =
match xs with
| [] -> mk_app (`Nil) [(ta, Q_Implicit)]
| x::xs' -> mk_app (`Cons) [(ta, Q_Implicit);
(quotea x, Q_Explicit);
(quote_list ta quotea xs', Q_Explicit)]
(** Quotes a variable map *)
let quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =
let quote_map_entry (p:(nat * a)) : Tac term =
mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);
(pack (Tv_Const (C_Int (fst p))), Q_Explicit);
(quotea (snd p), Q_Explicit)] in
let tyentry = mk_e_app (`tuple2) [(`nat); ta] in
let tlist = quote_list tyentry quote_map_entry (fst vm) in
let tylist = mk_e_app (`list) [tyentry] in
mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);
(tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]
(**
* A varlist is interpreted as the product of the entries in the variable map
*
* Unbound variables are mapped to the default value according to the map.
* This would normally never occur, but it makes it easy to prove correctness.
*)
[@@canon_attr]
let interp_var (#a:Type) (vm:vmap a) (i:index) =
match List.Tot.Base.assoc i (fst vm) with
| Some x -> x
| _ -> snd vm
[@@canon_attr]
private
let rec ivl_aux (#a:Type) (r:cr a) (vm:vmap a) (x:index) (t:varlist)
: Tot a (decreases t) =
let amult = r.cm_mult.mult in
match t with
| Nil_var -> interp_var vm x
| Cons_var x' t' -> amult (interp_var vm x) (ivl_aux r vm x' t')
[@@canon_attr]
let interp_vl (#a:Type) (r:cr a) (vm:vmap a) (l:varlist) =
let aone = r.cm_mult.unit in
match l with
| Nil_var -> aone
| Cons_var x t -> ivl_aux r vm x t
[@@canon_attr]
let interp_m (#a:Type) (r:cr a) (vm:vmap a) (c:a) (l:varlist) =
let amult = r.cm_mult.mult in
match l with
| Nil_var -> c
| Cons_var x t -> amult c (ivl_aux r vm x t)
[@@canon_attr]
let rec ics_aux (#a:Type) (r:cr a) (vm:vmap a) (x:a) (s:canonical_sum a)
: Tot a (decreases s) =
let aplus = r.cm_add.mult in
match s with
| Nil_monom -> x
| Cons_varlist l t -> aplus x (ics_aux r vm (interp_vl r vm l) t)
| Cons_monom c l t -> aplus x (ics_aux r vm (interp_m r vm c l) t)
(** Interpretation of a canonical sum *)
[@@canon_attr]
let interp_cs (#a:Type) (r:cr a) (vm:vmap a) (s:canonical_sum a) : a =
let azero = r.cm_add.unit in
match s with
| Nil_monom -> azero
| Cons_varlist l t -> ics_aux r vm (interp_vl r vm l) t
| Cons_monom c l t -> ics_aux r vm (interp_m r vm c l) t
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_sp (#a:Type) (r:cr a) (vm:vmap a) (p:spolynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| SPconst c -> c
| SPvar i -> interp_var vm i
| SPplus p1 p2 -> aplus (interp_sp r vm p1) (interp_sp r vm p2)
| SPmult p1 p2 -> amult (interp_sp r vm p1) (interp_sp r vm p2)
///
/// Proof of correctness
///
val mult_one_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_mult.unit x == x)
[SMTPat (r.cm_mult.mult r.cm_mult.unit x)]
let mult_one_l #a r x =
r.cm_mult.identity x
val mult_one_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_mult.unit == x)
[SMTPat (r.cm_mult.mult x r.cm_mult.unit)]
let mult_one_r #a r x =
r.cm_mult.commutativity r.cm_mult.unit x
val mult_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult r.cm_add.unit x == r.cm_add.unit)
[SMTPat (r.cm_mult.mult r.cm_add.unit x)]
let mult_zero_l #a r x =
r.mult_zero_l x
val mult_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_mult.mult x r.cm_add.unit == r.cm_add.unit)
[SMTPat (r.cm_mult.mult x r.cm_add.unit)]
let mult_zero_r #a r x =
r.cm_mult.commutativity x r.cm_add.unit
val add_zero_l (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult r.cm_add.unit x == x)
[SMTPat (r.cm_add.mult r.cm_add.unit x)]
let add_zero_l #a r x =
r.cm_add.identity x
val add_zero_r (#a:Type) (r:cr a) (x:a) :
Lemma (r.cm_add.mult x r.cm_add.unit == x)
[SMTPat (r.cm_add.mult x r.cm_add.unit)]
let add_zero_r #a r x =
r.cm_add.commutativity r.cm_add.unit x
val opp_unique (#a:Type) (r:cr a) (x y:a) : Lemma
(requires r.cm_add.mult x y == r.cm_add.unit)
(ensures y == r.opp x)
let opp_unique #a r x y =
let ( + ) = r.cm_add.mult in
let zero = r.cm_add.unit in
calc (==) {
y;
== { r.add_opp x }
y + (x + r.opp x);
== { r.cm_add.associativity y x (r.opp x) }
(y + x) + r.opp x;
== { r.cm_add.commutativity x y }
zero + r.opp x;
== { }
r.opp x;
}
val add_mult_opp (#a:Type) (r:cr a) (x:a) : Lemma
(r.cm_add.mult x (r.cm_mult.mult (r.opp r.cm_mult.unit) x) == r.cm_add.unit)
let add_mult_opp #a r x =
let ( + ) = r.cm_add.mult in
let ( * ) = r.cm_mult.mult in
let zero = r.cm_add.unit in
let one = r.cm_mult.unit in
calc (==) {
x + r.opp one * x;
== { }
one * x + r.opp one * x;
== { distribute_right r one (r.opp one) x }
(one + r.opp one) * x;
== { r.add_opp one }
zero * x;
== { }
zero;
}
val ivl_aux_ok (#a:Type) (r:cr a) (vm:vmap a) (v:varlist) (i:index) : Lemma
(ivl_aux r vm i v == r.cm_mult.mult (interp_var vm i) (interp_vl r vm v))
let ivl_aux_ok #a r vm v i = ()
val vm_aux_ok (#a:eqtype) (r:cr a) (vm:vmap a) (v:index) (t l:varlist) :
Lemma
(ensures
interp_vl r vm (vm_aux v t l) ==
r.cm_mult.mult (interp_vl r vm (Cons_var v t)) (interp_vl r vm l))
(decreases %[t; l; 1])
val varlist_merge_ok (#a:eqtype) (r:cr a) (vm:vmap a) (x y:varlist) :
Lemma
(ensures
interp_vl r vm (varlist_merge x y) ==
r.cm_mult.mult (interp_vl r vm x) (interp_vl r vm y))
(decreases %[x; y; 0])
let rec varlist_merge_ok #a r vm x y =
let amult = r.cm_mult.mult in
match x, y with
| Cons_var v1 t1, Nil_var -> ()
| Cons_var v1 t1, Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 y;
assert (
interp_vl r vm (varlist_merge x y) ==
amult (interp_var vm v1) (amult (interp_vl r vm t1) (interp_vl r vm y)));
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm y)
end
else
vm_aux_ok r vm v1 t1 y
| Nil_var, _ -> ()
and vm_aux_ok #a r vm v1 t1 l2 =
match l2 with
| Cons_var v2 t2 ->
if v1 < v2
then
begin
varlist_merge_ok r vm t1 l2;
r.cm_mult.associativity
(interp_var vm v1) (interp_vl r vm t1) (interp_vl r vm l2)
end
else
begin
vm_aux_ok r vm v1 t1 t2;
calc (==) {
interp_vl r vm (Cons_var v2 (vm_aux v1 t1 t2));
== { }
ivl_aux r vm v2 (vm_aux v1 t1 t2);
== { }
r.cm_mult.mult (interp_var vm v2) (interp_vl r vm (vm_aux v1 t1 t2));
== { }
r.cm_mult.mult (interp_var vm v2) (r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm t2) }
r.cm_mult.mult (interp_var vm v2)
(r.cm_mult.mult (interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) );
== { r.cm_mult.associativity
(interp_var vm v2)
(interp_vl r vm t2) (interp_vl r vm (Cons_var v1 t1)) }
r.cm_mult.mult
(r.cm_mult.mult (interp_var vm v2) (interp_vl r vm t2))
(interp_vl r vm (Cons_var v1 t1));
== { r.cm_mult.commutativity
(interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2)) }
r.cm_mult.mult (interp_vl r vm (Cons_var v1 t1)) (interp_vl r vm (Cons_var v2 t2));
}
end
| _ -> ()
val ics_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> s:canonical_sum a ->
Lemma (ensures ics_aux r vm x s == r.cm_add.mult x (interp_cs r vm s))
(decreases s)
let rec ics_aux_ok #a r vm x s =
match s with
| Nil_monom -> ()
| Cons_varlist l t ->
ics_aux_ok r vm (interp_vl r vm l) t
| Cons_monom c l t ->
ics_aux_ok r vm (interp_m r vm c l) t
val interp_m_ok: #a:eqtype -> r:cr a -> vm:vmap a -> x:a -> l:varlist ->
Lemma (interp_m r vm x l == r.cm_mult.mult x (interp_vl r vm l))
let interp_m_ok #a r vm x l = ()
val aplus_assoc_4: #a:Type -> r:cr a -> w:a -> x:a -> y:a -> z:a -> Lemma
(let aplus = r.cm_add.mult in
aplus (aplus w x) (aplus y z) == aplus (aplus w y) (aplus x z))
let aplus_assoc_4 #a r w x y z =
let aplus = r.cm_add.mult in
let assoc = r.cm_add.associativity in
let comm = r.cm_add.commutativity in
calc (==) {
aplus (aplus w x) (aplus y z);
== { assoc w x (aplus y z) }
aplus w (aplus x (aplus y z));
== { comm x (aplus y z) }
aplus w (aplus (aplus y z) x);
== { assoc w (aplus y z) x }
aplus (aplus w (aplus y z)) x;
== { assoc w y z }
aplus (aplus (aplus w y) z) x;
== { assoc (aplus w y) z x }
aplus (aplus w y) (aplus z x);
== { comm z x }
aplus (aplus w y) (aplus x z);
}
val canonical_sum_merge_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> s1:canonical_sum a -> s2:canonical_sum a ->
Lemma
(ensures
interp_cs r vm (canonical_sum_merge r s1 s2) ==
r.cm_add.mult (interp_cs r vm s1) (interp_cs r vm s2))
(decreases %[s1; s2; 0])
val csm_aux_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c1:a -> l1:varlist -> t1:canonical_sum a -> s2:canonical_sum a ->
Lemma
(ensures
interp_cs r vm (csm_aux r c1 l1 t1 s2) ==
r.cm_add.mult (interp_cs r vm (Cons_monom c1 l1 t1)) (interp_cs r vm s2))
(decreases %[t1; s2; 1])
let rec canonical_sum_merge_ok #a r vm s1 s2 =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s1 with
| Cons_monom c1 l1 t1 -> csm_aux_ok #a r vm c1 l1 t1 s2
| Cons_varlist l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
interp_cs r vm (csm_aux r aone l1 t1 s2);
== { csm_aux_ok #a r vm aone l1 t1 s2 }
aplus (interp_cs r vm (Cons_monom aone l1 t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (interp_vl r vm l1) t1 }
aplus (interp_cs r vm (Cons_varlist l1 t1))
(interp_cs r vm s2);
}
| Nil_monom -> ()
and csm_aux_ok #a r vm c1 l1 t1 s2 =
let aplus = r.cm_add.mult in
let aone = r.cm_mult.unit in
let amult = r.cm_mult.mult in
match s2 with
| Nil_monom -> ()
| Cons_monom c2 l2 t2 ->
let s1 = Cons_monom c1 l1 t1 in
if l1 = l2 then
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2);
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2) }
aplus (interp_m r vm (aplus c1 c2) l1)
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { canonical_sum_merge_ok r vm t1 t2 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm t2));
== { distribute_right r c1 c2 (interp_vl r vm l1) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(aplus (interp_cs r vm t1)
(interp_cs r vm t2));
== { aplus_assoc_4 r
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t1)
(interp_cs r vm t2) }
aplus (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1)
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c2 (interp_vl r vm l2)) t2;
interp_m_ok r vm c2 l2 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else if varlist_lt l1 l2 then
begin
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
ics_aux r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2);
== { ics_aux_ok r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2) }
aplus (interp_m r vm c1 l1)
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { interp_m_ok r vm c1 l1 }
aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { canonical_sum_merge_ok r vm t1 s2 }
aplus (amult c1 (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm s2));
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t1)
(interp_cs r vm s2)
}
aplus (aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2);
== { ics_aux_ok r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2) }
aplus (interp_m r vm c2 l2)
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { interp_m_ok r vm c2 l2 }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { csm_aux_ok r vm c1 l1 t1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm s1) (interp_cs r vm t2));
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2) (interp_cs r vm s1));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(interp_cs r vm s1)
}
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(interp_cs r vm s1);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s2) (interp_cs r vm s1);
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm s2) }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
| Cons_varlist l2 t2 -> // Same as Cons_monom with c2 = aone
let c2 = aone in
let s1 = Cons_monom c1 l1 t1 in
if l1 = l2 then
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2);
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1)
(canonical_sum_merge r t1 t2) }
aplus (interp_m r vm (aplus c1 c2) l1)
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 t2));
== { canonical_sum_merge_ok r vm t1 t2 }
aplus (amult (aplus c1 c2) (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm t2));
== { distribute_right r c1 c2 (interp_vl r vm l1) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(aplus (interp_cs r vm t1)
(interp_cs r vm t2));
== { aplus_assoc_4 r
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t1)
(interp_cs r vm t2) }
aplus (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1)
(aplus (amult c2 (interp_vl r vm l2)) (interp_cs r vm t2));
== { ics_aux_ok r vm (amult c2 (interp_vl r vm l2)) t2;
interp_m_ok r vm c2 l2 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else if varlist_lt l1 l2 then
begin
calc (==) {
interp_cs r vm (canonical_sum_merge r s1 s2);
== { }
ics_aux r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2);
== { ics_aux_ok r vm (interp_m r vm c1 l1)
(canonical_sum_merge r t1 s2) }
aplus (interp_m r vm c1 l1)
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { interp_m_ok r vm c1 l1 }
aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm (canonical_sum_merge r t1 s2));
== { canonical_sum_merge_ok r vm t1 s2 }
aplus (amult c1 (interp_vl r vm l1))
(aplus (interp_cs r vm t1) (interp_cs r vm s2));
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t1)
(interp_cs r vm s2)
}
aplus (aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1))
(interp_cs r vm s2);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
else
begin
calc (==) {
interp_cs r vm (csm_aux r c1 l1 t1 s2);
== { }
ics_aux r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2);
== { ics_aux_ok r vm (interp_m r vm c2 l2)
(csm_aux r c1 l1 t1 t2) }
aplus (interp_m r vm c2 l2)
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { interp_m_ok r vm c2 l2 }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (csm_aux r c1 l1 t1 t2));
== { csm_aux_ok r vm c1 l1 t1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm s1) (interp_cs r vm t2));
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2) (interp_cs r vm s1));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(interp_cs r vm s1)
}
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(interp_cs r vm s1);
== { ics_aux_ok r vm (amult c1 (interp_vl r vm l1)) t1;
interp_m_ok r vm c1 l1 }
aplus (interp_cs r vm s2) (interp_cs r vm s1);
== { r.cm_add.commutativity (interp_cs r vm s1) (interp_cs r vm s2) }
aplus (interp_cs r vm s1) (interp_cs r vm s2);
}
end
val monom_insert_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c1:a -> l1:varlist -> s2:canonical_sum a ->
Lemma
(interp_cs r vm (monom_insert r c1 l1 s2) ==
r.cm_add.mult (r.cm_mult.mult c1 (interp_vl r vm l1)) (interp_cs r vm s2))
let rec monom_insert_ok #a r vm c1 l1 s2 =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
let aone = r.cm_mult.unit in
match s2 with
| Cons_monom c2 l2 t2 ->
if l1 = l2
then
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom (aplus c1 c2) l1 t2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1) t2;
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1) t2 }
aplus (interp_m r vm (aplus c1 c2) l1) (interp_cs r vm t2);
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l2)) (interp_cs r vm t2);
== { distribute_right r c1 c2 (interp_vl r vm l2) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(interp_cs r vm t2);
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2) }
aplus (amult c1 (interp_vl r vm l1))
(aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
else
if varlist_lt l1 l2 then ()
else
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom c2 l2 (monom_insert r c1 l1 t2));
== { }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (monom_insert r c1 l1 t2));
== { monom_insert_ok r vm c1 l1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t2));
== { r.cm_add.commutativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)) }
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(amult c1 (interp_vl r vm l1));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (interp_cs r vm s2) (amult c1 (interp_vl r vm l1));
== { r.cm_add.commutativity
(interp_cs r vm s2)
(amult c1 (interp_vl r vm l1)) }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
| Cons_varlist l2 t2 -> // Same as Cons_monom with c2 = aone
let c2 = aone in
if l1 = l2
then
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom (aplus c1 c2) l1 t2);
== { }
ics_aux r vm (interp_m r vm (aplus c1 c2) l1) t2;
== { ics_aux_ok r vm (interp_m r vm (aplus c1 c2) l1) t2 }
aplus (interp_m r vm (aplus c1 c2) l1) (interp_cs r vm t2);
== { interp_m_ok r vm (aplus c1 c2) l1 }
aplus (amult (aplus c1 c2) (interp_vl r vm l2)) (interp_cs r vm t2);
== { distribute_right r c1 c2 (interp_vl r vm l2) }
aplus (aplus (amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2)))
(interp_cs r vm t2);
== { r.cm_add.associativity
(amult c1 (interp_vl r vm l1))
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2) }
aplus (amult c1 (interp_vl r vm l1))
(aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
else
if varlist_lt l1 l2 then ()
else
calc (==) {
interp_cs r vm (monom_insert r c1 l1 s2);
== { }
interp_cs r vm (Cons_monom c2 l2 (monom_insert r c1 l1 t2));
== { }
aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm (monom_insert r c1 l1 t2));
== { monom_insert_ok r vm c1 l1 t2 }
aplus (amult c2 (interp_vl r vm l2))
(aplus (amult c1 (interp_vl r vm l1))
(interp_cs r vm t2));
== { r.cm_add.commutativity
(amult c1 (interp_vl r vm l1))
(interp_cs r vm t2) }
aplus (amult c2 (interp_vl r vm l2))
(aplus (interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)));
== { r.cm_add.associativity
(amult c2 (interp_vl r vm l2))
(interp_cs r vm t2)
(amult c1 (interp_vl r vm l1)) }
aplus (aplus (amult c2 (interp_vl r vm l2))
(interp_cs r vm t2))
(amult c1 (interp_vl r vm l1));
== { ics_aux_ok r vm (interp_m r vm c2 l2) t2 }
aplus (interp_cs r vm s2) (amult c1 (interp_vl r vm l1));
== { r.cm_add.commutativity
(interp_cs r vm s2)
(amult c1 (interp_vl r vm l1)) }
aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2);
}
| Nil_monom -> ()
val varlist_insert_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> l1:varlist -> s2:canonical_sum a ->
Lemma (interp_cs r vm (varlist_insert r l1 s2) ==
r.cm_add.mult (interp_vl r vm l1) (interp_cs r vm s2))
let varlist_insert_ok #a r vm l1 s2 =
let aone = r.cm_mult.unit in
monom_insert_ok r vm aone l1 s2
val canonical_sum_scalar_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c0:a -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar r c0 s) ==
r.cm_mult.mult c0 (interp_cs r vm s))
let rec canonical_sum_scalar_ok #a r vm c0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar r c0 s);
== { }
interp_cs r vm (Cons_monom (amult c0 c) l (canonical_sum_scalar r c0 t));
== { }
aplus (amult (amult c0 c) (interp_vl r vm l))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { r.cm_mult.associativity c0 c (interp_vl r vm l) }
aplus (amult c0 (amult c (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { canonical_sum_scalar_ok r vm c0 t }
aplus (amult c0 (amult c (interp_vl r vm l)))
(amult c0 (interp_cs r vm t));
== { r.distribute c0 (amult c (interp_vl r vm l))
(interp_cs r vm t) }
amult c0 (aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult c0 (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = r.cm_mult.unit
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar r c0 s);
== { }
interp_cs r vm (Cons_monom (amult c0 c) l (canonical_sum_scalar r c0 t));
== { }
aplus (amult (amult c0 c) (interp_vl r vm l))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { r.cm_mult.associativity c0 c (interp_vl r vm l) }
aplus (amult c0 (amult c (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar r c0 t));
== { canonical_sum_scalar_ok r vm c0 t }
aplus (amult c0 (amult c (interp_vl r vm l)))
(amult c0 (interp_cs r vm t));
== { r.distribute c0 (amult c (interp_vl r vm l))
(interp_cs r vm t) }
amult c0 (aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult c0 (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_scalar2_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> l0:varlist -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar2 r l0 s) ==
r.cm_mult.mult (interp_vl r vm l0) (interp_cs r vm s))
let rec canonical_sum_scalar2_ok #a r vm l0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar2 r l0 s);
== { }
interp_cs r vm
(monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t));
== { monom_insert_ok r vm c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t) }
aplus (amult c (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { canonical_sum_scalar2_ok r vm l0 t }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity c (interp_vl r vm l0)
(interp_vl r vm l) }
aplus (amult (amult c (interp_vl r vm l0)) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.commutativity (interp_vl r vm l0) c }
aplus (amult (amult (interp_vl r vm l0) c) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity (interp_vl r vm l0) c (interp_vl r vm l) }
aplus (amult (interp_vl r vm l0) (amult c (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.distribute (interp_vl r vm l0)
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (interp_vl r vm l0)
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (interp_vl r vm l0) (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = aone
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar2 r l0 s);
== { }
interp_cs r vm
(monom_insert r c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t));
== { monom_insert_ok r vm c (varlist_merge l0 l) (canonical_sum_scalar2 r l0 t) }
aplus (amult c (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar2 r l0 t));
== { canonical_sum_scalar2_ok r vm l0 t }
aplus (amult c (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity c (interp_vl r vm l0)
(interp_vl r vm l) }
aplus (amult (amult c (interp_vl r vm l0)) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.commutativity (interp_vl r vm l0) c }
aplus (amult (amult (interp_vl r vm l0) c) (interp_vl r vm l))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.cm_mult.associativity (interp_vl r vm l0) c (interp_vl r vm l) }
aplus (amult (interp_vl r vm l0) (amult c (interp_vl r vm l)))
(amult (interp_vl r vm l0) (interp_cs r vm t));
== { r.distribute (interp_vl r vm l0)
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (interp_vl r vm l0)
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (interp_vl r vm l0) (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_scalar3_ok: #a:eqtype -> r:cr a -> vm:vmap a
-> c0:a -> l0:varlist -> s:canonical_sum a ->
Lemma (
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s) ==
r.cm_mult.mult (r.cm_mult.mult c0 (interp_vl r vm l0)) (interp_cs r vm s))
let rec canonical_sum_scalar3_ok #a r vm c0 l0 s =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s with
| Cons_monom c l t ->
calc (==) {
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s);
== { }
interp_cs r vm
(monom_insert r (amult c0 c) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t));
== { monom_insert_ok r vm (amult c0 c) (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t) }
aplus (amult (amult c0 c) (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { canonical_sum_scalar3_ok r vm c0 l0 t }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 c)
(interp_vl r vm l0) (interp_vl r vm l) }
aplus (amult (amult (amult c0 c) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c0 c }
aplus (amult (amult (amult c c0) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity c c0 (interp_vl r vm l0) }
aplus (amult (amult c (amult c0 (interp_vl r vm l0))) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c (amult c0 (interp_vl r vm l0)) }
aplus (amult (amult (amult c0 (interp_vl r vm l0)) c) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 (interp_vl r vm l0)) c (interp_vl r vm l) }
aplus (amult (amult c0 (interp_vl r vm l0)) (amult c (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.distribute (amult c0 (interp_vl r vm l0))
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (amult c0 (interp_vl r vm l0))
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm s);
}
| Cons_varlist l t -> // Same as Cons_monom c l t with c = aone
let c = aone in
calc (==) {
interp_cs r vm (canonical_sum_scalar3 r c0 l0 s);
== { }
interp_cs r vm
(monom_insert r (amult c0 c) (varlist_merge l0 l)
(canonical_sum_scalar3 r c0 l0 t));
== { monom_insert_ok r vm (amult c0 c) (varlist_merge l0 l) (canonical_sum_scalar3 r c0 l0 t) }
aplus (amult (amult c0 c) (interp_vl r vm (varlist_merge l0 l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { varlist_merge_ok r vm l0 l }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(interp_cs r vm (canonical_sum_scalar3 r c0 l0 t));
== { canonical_sum_scalar3_ok r vm c0 l0 t }
aplus (amult (amult c0 c) (amult (interp_vl r vm l0) (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 c)
(interp_vl r vm l0) (interp_vl r vm l) }
aplus (amult (amult (amult c0 c) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c0 c }
aplus (amult (amult (amult c c0) (interp_vl r vm l0)) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity c c0 (interp_vl r vm l0) }
aplus (amult (amult c (amult c0 (interp_vl r vm l0))) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.commutativity c (amult c0 (interp_vl r vm l0)) }
aplus (amult (amult (amult c0 (interp_vl r vm l0)) c) (interp_vl r vm l))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.cm_mult.associativity (amult c0 (interp_vl r vm l0)) c (interp_vl r vm l) }
aplus (amult (amult c0 (interp_vl r vm l0)) (amult c (interp_vl r vm l)))
(amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm t));
== { r.distribute (amult c0 (interp_vl r vm l0))
(amult c (interp_vl r vm l)) (interp_cs r vm t) }
amult (amult c0 (interp_vl r vm l0))
(aplus (amult c (interp_vl r vm l)) (interp_cs r vm t));
== { }
amult (amult c0 (interp_vl r vm l0)) (interp_cs r vm s);
}
| Nil_monom -> ()
val canonical_sum_prod_ok: #a:eqtype -> r:cr a -> vm:vmap a ->
s1:canonical_sum a -> s2:canonical_sum a ->
Lemma (interp_cs r vm (canonical_sum_prod r s1 s2) ==
r.cm_mult.mult (interp_cs r vm s1) (interp_cs r vm s2))
let rec canonical_sum_prod_ok #a r vm s1 s2 =
let aone = r.cm_mult.unit in
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match s1 with
| Cons_monom c1 l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_prod r s1 s2);
== { }
interp_cs r vm
(canonical_sum_merge r (canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2));
== { canonical_sum_merge_ok r vm
(canonical_sum_scalar3 r c1 l1 s2)
(canonical_sum_prod r t1 s2) }
aplus (interp_cs r vm (canonical_sum_scalar3 r c1 l1 s2))
(interp_cs r vm (canonical_sum_prod r t1 s2));
== { canonical_sum_scalar3_ok r vm c1 l1 s2;
canonical_sum_prod_ok r vm t1 s2 }
aplus (amult (amult c1 (interp_vl r vm l1)) (interp_cs r vm s2))
(amult (interp_cs r vm t1) (interp_cs r vm s2));
== { distribute_right r (amult c1 (interp_vl r vm l1))
(interp_cs r vm t1) (interp_cs r vm s2) }
amult (aplus (amult c1 (interp_vl r vm l1)) (interp_cs r vm t1))
(interp_cs r vm s2);
== { }
amult (interp_cs r vm s1) (interp_cs r vm s2);
}
| Cons_varlist l1 t1 ->
calc (==) {
interp_cs r vm (canonical_sum_prod r s1 s2);
== { }
interp_cs r vm
(canonical_sum_merge r (canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2));
== { canonical_sum_merge_ok r vm
(canonical_sum_scalar2 r l1 s2)
(canonical_sum_prod r t1 s2) }
aplus (interp_cs r vm (canonical_sum_scalar2 r l1 s2))
(interp_cs r vm (canonical_sum_prod r t1 s2));
== { canonical_sum_scalar2_ok r vm l1 s2;
canonical_sum_prod_ok r vm t1 s2 }
aplus (amult (interp_vl r vm l1) (interp_cs r vm s2))
(amult (interp_cs r vm t1) (interp_cs r vm s2));
== { distribute_right r (interp_vl r vm l1)
(interp_cs r vm t1) (interp_cs r vm s2) }
amult (aplus (interp_vl r vm l1) (interp_cs r vm t1))
(interp_cs r vm s2);
== { }
amult (interp_cs r vm s1) (interp_cs r vm s2);
}
| Nil_monom -> ()
val spolynomial_normalize_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:spolynomial a ->
Lemma (interp_cs r vm (spolynomial_normalize r p) == interp_sp r vm p)
let rec spolynomial_normalize_ok #a r vm p =
match p with
| SPvar _ -> ()
| SPconst _ -> ()
| SPplus l q ->
canonical_sum_merge_ok r vm
(spolynomial_normalize r l) (spolynomial_normalize r q);
spolynomial_normalize_ok r vm l;
spolynomial_normalize_ok r vm q
| SPmult l q ->
canonical_sum_prod_ok r vm
(spolynomial_normalize r l) (spolynomial_normalize r q);
spolynomial_normalize_ok r vm l;
spolynomial_normalize_ok r vm q
val canonical_sum_simplify_ok: #a:eqtype -> r:cr a -> vm:vmap a -> s:canonical_sum a ->
Lemma (interp_cs r vm (canonical_sum_simplify r s) == interp_cs r vm s)
let rec canonical_sum_simplify_ok #a r vm s =
let azero = r.cm_add.unit in
let aone = r.cm_mult.unit in
match s with
| Cons_monom c _ t -> canonical_sum_simplify_ok r vm t
| Cons_varlist _ t -> canonical_sum_simplify_ok r vm t
| Nil_monom -> ()
val spolynomial_simplify_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:spolynomial a ->
Lemma (interp_cs r vm (spolynomial_simplify r p) == interp_sp r vm p)
let spolynomial_simplify_ok #a r vm p =
canonical_sum_simplify_ok r vm (spolynomial_normalize r p);
spolynomial_normalize_ok r vm p
(**
* This is the type where we first reflect expressions,
* before eliminating additive inverses
**)
type polynomial a =
| Pvar : index -> polynomial a
| Pconst : a -> polynomial a
| Pplus : polynomial a -> polynomial a -> polynomial a
| Pmult : polynomial a -> polynomial a -> polynomial a
| Popp : polynomial a -> polynomial a
(** Canonize a reflected expression *)
val polynomial_normalize: #a:eqtype -> cr a -> polynomial a -> canonical_sum a
[@@canon_attr]
let rec polynomial_normalize #a r p =
match p with
| Pvar i -> Cons_varlist (Cons_var i Nil_var) Nil_monom
| Pconst c -> Cons_monom c Nil_var Nil_monom
| Pplus l q ->
canonical_sum_merge r (polynomial_normalize r l) (polynomial_normalize r q)
| Pmult l q ->
canonical_sum_prod r (polynomial_normalize r l) (polynomial_normalize r q)
| Popp p ->
canonical_sum_scalar3 r (r.opp r.cm_mult.unit) Nil_var (polynomial_normalize r p)
val polynomial_simplify: #a:eqtype -> cr a -> polynomial a -> canonical_sum a
[@@canon_attr]
let polynomial_simplify #a r p =
canonical_sum_simplify r
(polynomial_normalize r p)
(** Translate to a representation without additive inverses *)
val spolynomial_of: #a:eqtype -> cr a -> polynomial a -> spolynomial a
[@@canon_attr]
let rec spolynomial_of #a r p =
match p with
| Pvar i -> SPvar i
| Pconst c -> SPconst c
| Pplus l q -> SPplus (spolynomial_of r l) (spolynomial_of r q)
| Pmult l q -> SPmult (spolynomial_of r l) (spolynomial_of r q)
| Popp p -> SPmult (SPconst (r.opp r.cm_mult.unit)) (spolynomial_of r p)
(** Interpretation of a polynomial *)
[@@canon_attr]
let rec interp_p (#a:Type) (r:cr a) (vm:vmap a) (p:polynomial a) : a =
let aplus = r.cm_add.mult in
let amult = r.cm_mult.mult in
match p with
| Pconst c -> c
| Pvar i -> interp_var vm i
| Pplus p1 p2 -> aplus (interp_p r vm p1) (interp_p r vm p2)
| Pmult p1 p2 -> amult (interp_p r vm p1) (interp_p r vm p2)
| Popp p -> r.opp (interp_p r vm p)
val spolynomial_of_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:polynomial a ->
Lemma (interp_p r vm p == interp_sp r vm (spolynomial_of r p))
let rec spolynomial_of_ok #a r vm p =
match p with
| Pconst c -> ()
| Pvar i -> ()
| Pplus p1 p2 ->
spolynomial_of_ok r vm p1;
spolynomial_of_ok r vm p2
| Pmult p1 p2 ->
spolynomial_of_ok r vm p1;
spolynomial_of_ok r vm p2
| Popp p ->
spolynomial_of_ok r vm p;
let x = interp_sp r vm (spolynomial_of r p) in
let y = r.cm_mult.mult (r.opp r.cm_mult.unit) x in
add_mult_opp r x;
opp_unique r x y
val polynomial_normalize_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:polynomial a ->
Lemma (interp_cs r vm (polynomial_normalize r p) ==
interp_cs r vm (spolynomial_normalize r (spolynomial_of r p)))
let rec polynomial_normalize_ok #a r vm p =
match p with
| Pvar _ -> ()
| Pconst _ -> ()
| Pplus l q ->
canonical_sum_merge_ok r vm
(polynomial_normalize r l)
(polynomial_normalize r q);
canonical_sum_merge_ok r vm
(spolynomial_normalize r (spolynomial_of r l))
(spolynomial_normalize r (spolynomial_of r q));
polynomial_normalize_ok r vm l;
polynomial_normalize_ok r vm q
| Pmult l q ->
canonical_sum_prod_ok r vm
(polynomial_normalize r l)
(polynomial_normalize r q);
canonical_sum_prod_ok r vm
(spolynomial_normalize r (spolynomial_of r l))
(spolynomial_normalize r (spolynomial_of r q));
polynomial_normalize_ok r vm l;
polynomial_normalize_ok r vm q
| Popp p1 ->
let l = SPconst (r.opp r.cm_mult.unit) in
polynomial_normalize_ok r vm p1;
canonical_sum_prod_ok r vm
(spolynomial_normalize r l)
(polynomial_normalize r p1);
canonical_sum_prod_ok r vm
(spolynomial_normalize r l)
(spolynomial_normalize r (spolynomial_of r p1))
val polynomial_simplify_ok: #a:eqtype -> r:cr a -> vm:vmap a -> p:polynomial a ->
Lemma (interp_cs r vm (polynomial_simplify r p) == interp_p r vm p)
let polynomial_simplify_ok #a r vm p =
calc (==) {
interp_cs r vm (polynomial_simplify r p);
== { }
interp_cs r vm (canonical_sum_simplify r (polynomial_normalize r p));
== { canonical_sum_simplify_ok r vm (polynomial_normalize r p) }
interp_cs r vm (polynomial_normalize r p);
== { polynomial_normalize_ok r vm p }
interp_cs r vm (spolynomial_normalize r (spolynomial_of r p));
== { spolynomial_normalize_ok r vm (spolynomial_of r p) }
interp_sp r vm (spolynomial_of r p);
== { spolynomial_of_ok r vm p }
interp_p r vm p;
}
///
/// Tactic definition
///
(* Only dump when debugging is on *)
let ddump m = if debugging () then dump m
(**
* Finds the position of first occurrence of x in xs.
* This is specialized to terms and their funny term_eq.
**)
let rec find_aux (n:nat) (x:term) (xs:list term) : Tac (option nat) =
match xs with
| [] -> None
| x'::xs' -> if term_eq x x' then Some n else find_aux (n+1) x xs' | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.CanonCommSemiring.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Tactics.NamedView.term -> xs: Prims.list FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac (FStar.Pervasives.Native.option Prims.nat) | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.CanonCommSemiring.find_aux"
] | [] | false | true | false | false | false | let find =
| find_aux 0 | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.