effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat64 = Vale.Def.Words_s.nat64 | let nat64 = | false | null | false | Vale.Def.Words_s.nat64 | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Words_s.nat64"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16 | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val nat64 : Type0 | [] | Vale.Def.Types_s.nat64 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 15,
"start_col": 19,
"start_line": 15
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat32_reveal = opaque_revealer (`%reverse_bytes_nat32) reverse_bytes_nat32 reverse_bytes_nat32_def | let reverse_bytes_nat32_reveal = | false | null | true | opaque_revealer (`%reverse_bytes_nat32) reverse_bytes_nat32 reverse_bytes_nat32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.reverse_bytes_nat32",
"Vale.Def.Types_s.reverse_bytes_nat32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b)
let reverse_bytes_nat32_def (n:nat32) : nat32 =
be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat32_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.reverse_bytes_nat32 == Vale.Def.Types_s.reverse_bytes_nat32_def) | [] | Vale.Def.Types_s.reverse_bytes_nat32_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.reverse_bytes_nat32 == Vale.Def.Types_s.reverse_bytes_nat32_def) | {
"end_col": 128,
"end_line": 120,
"start_col": 45,
"start_line": 120
} |
|
Prims.Tot | val quad32_xor_def (x y: quad32) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y | val quad32_xor_def (x y: quad32) : quad32
let quad32_xor_def (x y: quad32) : quad32 = | false | null | false | four_map2 nat32_xor x y | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Words.Four_s.four_map2",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.nat32_xor"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32 | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val quad32_xor_def (x y: quad32) : quad32 | [] | Vale.Def.Types_s.quad32_xor_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Types_s.quad32 -> y: Vale.Def.Types_s.quad32 -> Vale.Def.Types_s.quad32 | {
"end_col": 66,
"end_line": 39,
"start_col": 43,
"start_line": 39
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let quad32_xor = opaque_make quad32_xor_def | let quad32_xor = | false | null | false | opaque_make quad32_xor_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.quad32_xor_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32 | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val quad32_xor : _: Vale.Def.Types_s.quad32 -> _: Vale.Def.Types_s.quad32 -> Vale.Def.Types_s.quad32 | [] | Vale.Def.Types_s.quad32_xor | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Vale.Def.Types_s.quad32 -> _: Vale.Def.Types_s.quad32 -> Vale.Def.Types_s.quad32 | {
"end_col": 62,
"end_line": 40,
"start_col": 36,
"start_line": 40
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def | let quad32_xor_reveal = | false | null | true | opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.quad32_xor",
"Vale.Def.Types_s.quad32_xor_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val quad32_xor_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma (ensures Vale.Def.Types_s.quad32_xor == Vale.Def.Types_s.quad32_xor_def) | [] | Vale.Def.Types_s.quad32_xor_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma (ensures Vale.Def.Types_s.quad32_xor == Vale.Def.Types_s.quad32_xor_def) | {
"end_col": 92,
"end_line": 41,
"start_col": 36,
"start_line": 41
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat32 = Vale.Def.Words_s.nat32 | let nat32 = | false | null | false | Vale.Def.Words_s.nat32 | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Words_s.nat32"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8 | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val nat32 : Type0 | [] | Vale.Def.Types_s.nat32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 14,
"start_col": 19,
"start_line": 14
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat64 = opaque_make reverse_bytes_nat64_def | let reverse_bytes_nat64 = | false | null | false | opaque_make reverse_bytes_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.Def.Types_s.nat64",
"Vale.Def.Types_s.reverse_bytes_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b)
let reverse_bytes_nat32_def (n:nat32) : nat32 =
be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n))
[@"opaque_to_smt"] let reverse_bytes_nat32 = opaque_make reverse_bytes_nat32_def
irreducible let reverse_bytes_nat32_reveal = opaque_revealer (`%reverse_bytes_nat32) reverse_bytes_nat32 reverse_bytes_nat32_def
let reverse_bytes_nat64_def (n:nat64) : nat64 =
let Mktwo n0 n1 = nat_to_two 32 n in | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat64 : _: Vale.Def.Types_s.nat64 -> Vale.Def.Types_s.nat64 | [] | Vale.Def.Types_s.reverse_bytes_nat64 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Vale.Def.Types_s.nat64 -> Vale.Def.Types_s.nat64 | {
"end_col": 80,
"end_line": 125,
"start_col": 45,
"start_line": 125
} |
|
Prims.Tot | val select_word (q: quad32) (selector: twobits) : nat32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector | val select_word (q: quad32) (selector: twobits) : nat32
let select_word (q: quad32) (selector: twobits) : nat32 = | false | null | false | four_select q selector | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.twobits",
"Vale.Def.Words.Four_s.four_select",
"Vale.Def.Types_s.nat32"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val select_word (q: quad32) (selector: twobits) : nat32 | [] | Vale.Def.Types_s.select_word | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32 -> selector: Vale.Def.Types_s.twobits -> Vale.Def.Types_s.nat32 | {
"end_col": 78,
"end_line": 43,
"start_col": 56,
"start_line": 43
} |
Prims.Tot | val nat32_xor (x y: nat32) : nat32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat32_xor (x y:nat32) : nat32 = ixor x y | val nat32_xor (x y: nat32) : nat32
let nat32_xor (x y: nat32) : nat32 = | false | null | false | ixor x y | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.ixor",
"Vale.Def.Words_s.pow2_32"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val nat32_xor (x y: nat32) : nat32 | [] | Vale.Def.Types_s.nat32_xor | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Types_s.nat32 -> y: Vale.Def.Types_s.nat32 -> Vale.Def.Types_s.nat32 | {
"end_col": 51,
"end_line": 29,
"start_col": 43,
"start_line": 29
} |
Prims.Tot | val insert_nat32 (q: quad32) (n: nat32) (i: twobits) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i | val insert_nat32 (q: quad32) (n: nat32) (i: twobits) : quad32
let insert_nat32 (q: quad32) (n: nat32) (i: twobits) : quad32 = | false | null | false | four_insert q n i | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.twobits",
"Vale.Def.Words.Four_s.four_insert"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val insert_nat32 (q: quad32) (n: nat32) (i: twobits) : quad32 | [] | Vale.Def.Types_s.insert_nat32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32 -> n: Vale.Def.Types_s.nat32 -> i: Vale.Def.Types_s.twobits
-> Vale.Def.Types_s.quad32 | {
"end_col": 78,
"end_line": 45,
"start_col": 61,
"start_line": 45
} |
Prims.Tot | val le_seq_quad32_to_bytes_def (b: seq quad32) : seq nat8 | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b) | val le_seq_quad32_to_bytes_def (b: seq quad32) : seq nat8
let le_seq_quad32_to_bytes_def (b: seq quad32) : seq nat8 = | false | null | false | seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.nat8"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b)) | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val le_seq_quad32_to_bytes_def (b: seq quad32) : seq nat8 | [] | Vale.Def.Types_s.le_seq_quad32_to_bytes_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> FStar.Seq.Base.seq Vale.Def.Types_s.nat8 | {
"end_col": 49,
"end_line": 99,
"start_col": 2,
"start_line": 99
} |
Prims.Tot | val le_bytes_to_nat32 (b: seq4 nat8) : nat32 | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b) | val le_bytes_to_nat32 (b: seq4 nat8) : nat32
let le_bytes_to_nat32 (b: seq4 nat8) : nat32 = | false | null | false | four_to_nat 8 (seq_to_four_LE b) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Vale.Def.Types_s.nat32"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_nat32 (b: seq4 nat8) : nat32 | [] | Vale.Def.Types_s.le_bytes_to_nat32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Words.Seq_s.seq4 Vale.Def.Types_s.nat8 -> Vale.Def.Types_s.nat32 | {
"end_col": 34,
"end_line": 55,
"start_col": 2,
"start_line": 55
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def | let le_nat64_to_bytes = | false | null | false | opaque_make le_nat64_to_bytes_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.Def.Types_s.nat64",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Prims.l_True",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.Def.Types_s.le_nat64_to_bytes_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) = | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_nat64_to_bytes : b: Vale.Def.Types_s.nat64 -> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.nat8) | [] | Vale.Def.Types_s.le_nat64_to_bytes | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Types_s.nat64 -> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.nat8) | {
"end_col": 76,
"end_line": 81,
"start_col": 43,
"start_line": 81
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def | let le_bytes_to_nat64_reveal = | false | null | true | opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.nat64",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.le_bytes_to_nat64",
"Vale.Def.Types_s.le_bytes_to_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_nat64_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_bytes_to_nat64 == Vale.Def.Types_s.le_bytes_to_nat64_def) | [] | Vale.Def.Types_s.le_bytes_to_nat64_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_bytes_to_nat64 == Vale.Def.Types_s.le_bytes_to_nat64_def) | {
"end_col": 120,
"end_line": 77,
"start_col": 43,
"start_line": 77
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat16 = Vale.Def.Words_s.nat16 | let nat16 = | false | null | false | Vale.Def.Words_s.nat16 | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Words_s.nat16"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val nat16 : Type0 | [] | Vale.Def.Types_s.nat16 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 13,
"start_col": 19,
"start_line": 13
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def | let insert_nat64_reveal = | false | null | true | opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat64",
"Vale.Def.Words_s.nat1",
"Vale.Def.Types_s.insert_nat64",
"Vale.Def.Types_s.insert_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val insert_nat64_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.insert_nat64 == Vale.Def.Types_s.insert_nat64_def) | [] | Vale.Def.Types_s.insert_nat64_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.insert_nat64 == Vale.Def.Types_s.insert_nat64_def) | {
"end_col": 100,
"end_line": 50,
"start_col": 38,
"start_line": 50
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def | let le_bytes_to_quad32_reveal = | false | null | true | opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.le_bytes_to_quad32",
"Vale.Def.Types_s.le_bytes_to_quad32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_quad32_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_bytes_to_quad32 == Vale.Def.Types_s.le_bytes_to_quad32_def) | [] | Vale.Def.Types_s.le_bytes_to_quad32_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_bytes_to_quad32 == Vale.Def.Types_s.le_bytes_to_quad32_def) | {
"end_col": 124,
"end_line": 87,
"start_col": 44,
"start_line": 87
} |
|
Prims.Tot | val byte_to_twobits (b: nat8) : bits_of_byte | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b | val byte_to_twobits (b: nat8) : bits_of_byte
let byte_to_twobits (b: nat8) : bits_of_byte = | false | null | false | nat_to_four_unfold 2 b | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Four_s.nat_to_four_unfold",
"Vale.Def.Types_s.bits_of_byte"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val byte_to_twobits (b: nat8) : bits_of_byte | [] | Vale.Def.Types_s.byte_to_twobits | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Types_s.nat8 -> Vale.Def.Types_s.bits_of_byte | {
"end_col": 68,
"end_line": 34,
"start_col": 46,
"start_line": 34
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let insert_nat64 = opaque_make insert_nat64_def | let insert_nat64 = | false | null | false | opaque_make insert_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat64",
"Vale.Def.Words_s.nat1",
"Vale.Def.Types_s.insert_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 = | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val insert_nat64 : _: Vale.Def.Types_s.quad32 -> _: Vale.Def.Types_s.nat64 -> _: Vale.Def.Words_s.nat1
-> Vale.Def.Types_s.quad32 | [] | Vale.Def.Types_s.insert_nat64 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Vale.Def.Types_s.quad32 -> _: Vale.Def.Types_s.nat64 -> _: Vale.Def.Words_s.nat1
-> Vale.Def.Types_s.quad32 | {
"end_col": 66,
"end_line": 49,
"start_col": 38,
"start_line": 49
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat32 = opaque_make reverse_bytes_nat32_def | let reverse_bytes_nat32 = | false | null | false | opaque_make reverse_bytes_nat32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.reverse_bytes_nat32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b)
let reverse_bytes_nat32_def (n:nat32) : nat32 = | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat32 : _: Vale.Def.Types_s.nat32 -> Vale.Def.Types_s.nat32 | [] | Vale.Def.Types_s.reverse_bytes_nat32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Vale.Def.Types_s.nat32 -> Vale.Def.Types_s.nat32 | {
"end_col": 80,
"end_line": 119,
"start_col": 45,
"start_line": 119
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def | let le_seq_quad32_to_bytes = | false | null | false | opaque_make le_seq_quad32_to_bytes_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.le_seq_quad32_to_bytes_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 = | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val le_seq_quad32_to_bytes : _: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> FStar.Seq.Base.seq Vale.Def.Types_s.nat8 | [] | Vale.Def.Types_s.le_seq_quad32_to_bytes | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> FStar.Seq.Base.seq Vale.Def.Types_s.nat8 | {
"end_col": 86,
"end_line": 100,
"start_col": 48,
"start_line": 100
} |
|
Prims.Tot | val insert_nat64_def (q: quad32) (n: nat64) (i: nat1) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i) | val insert_nat64_def (q: quad32) (n: nat64) (i: nat1) : quad32
let insert_nat64_def (q: quad32) (n: nat64) (i: nat1) : quad32 = | false | null | false | two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat64",
"Vale.Def.Words_s.nat1",
"Vale.Def.Words.Four_s.two_two_to_four",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words.Two_s.two_insert",
"Vale.Def.Words_s.two",
"Vale.Def.Words.Four_s.four_to_two_two",
"Vale.Def.Words.Two_s.nat_to_two"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val insert_nat64_def (q: quad32) (n: nat64) (i: nat1) : quad32 | [] | Vale.Def.Types_s.insert_nat64_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32 -> n: Vale.Def.Types_s.nat64 -> i: Vale.Def.Words_s.nat1
-> Vale.Def.Types_s.quad32 | {
"end_col": 70,
"end_line": 48,
"start_col": 2,
"start_line": 48
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def | let le_bytes_to_nat64 = | false | null | false | opaque_make le_bytes_to_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Opaque_s.opaque_make",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.nat64",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.le_bytes_to_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) = | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_nat64 : b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.nat64 | [] | Vale.Def.Types_s.le_bytes_to_nat64 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.nat64 | {
"end_col": 76,
"end_line": 76,
"start_col": 43,
"start_line": 76
} |
|
Prims.Tot | val be_bytes_to_nat32 (b: seq4 nat8) : nat32 | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b) | val be_bytes_to_nat32 (b: seq4 nat8) : nat32
let be_bytes_to_nat32 (b: seq4 nat8) : nat32 = | false | null | false | four_to_nat 8 (seq_to_four_BE b) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq_s.seq_to_four_BE",
"Vale.Def.Types_s.nat32"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val be_bytes_to_nat32 (b: seq4 nat8) : nat32 | [] | Vale.Def.Types_s.be_bytes_to_nat32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Words.Seq_s.seq4 Vale.Def.Types_s.nat8 -> Vale.Def.Types_s.nat32 | {
"end_col": 34,
"end_line": 64,
"start_col": 2,
"start_line": 64
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def | let be_bytes_to_quad32 = | false | null | false | opaque_make be_bytes_to_quad32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Opaque_s.opaque_make",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.be_bytes_to_quad32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) = | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val be_bytes_to_quad32 : b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | [] | Vale.Def.Types_s.be_bytes_to_quad32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | {
"end_col": 78,
"end_line": 91,
"start_col": 44,
"start_line": 91
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def | let le_bytes_to_quad32 = | false | null | false | opaque_make le_bytes_to_quad32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Opaque_s.opaque_make",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.le_bytes_to_quad32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) = | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_quad32 : b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | [] | Vale.Def.Types_s.le_bytes_to_quad32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | {
"end_col": 78,
"end_line": 86,
"start_col": 44,
"start_line": 86
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat64_reveal = opaque_revealer (`%reverse_bytes_nat64) reverse_bytes_nat64 reverse_bytes_nat64_def | let reverse_bytes_nat64_reveal = | false | null | true | opaque_revealer (`%reverse_bytes_nat64) reverse_bytes_nat64 reverse_bytes_nat64_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.nat64",
"Vale.Def.Types_s.reverse_bytes_nat64",
"Vale.Def.Types_s.reverse_bytes_nat64_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b)
let reverse_bytes_nat32_def (n:nat32) : nat32 =
be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n))
[@"opaque_to_smt"] let reverse_bytes_nat32 = opaque_make reverse_bytes_nat32_def
irreducible let reverse_bytes_nat32_reveal = opaque_revealer (`%reverse_bytes_nat32) reverse_bytes_nat32 reverse_bytes_nat32_def
let reverse_bytes_nat64_def (n:nat64) : nat64 =
let Mktwo n0 n1 = nat_to_two 32 n in
two_to_nat 32 (Mktwo (reverse_bytes_nat32 n1) (reverse_bytes_nat32 n0)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat64_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.reverse_bytes_nat64 == Vale.Def.Types_s.reverse_bytes_nat64_def) | [] | Vale.Def.Types_s.reverse_bytes_nat64_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.reverse_bytes_nat64 == Vale.Def.Types_s.reverse_bytes_nat64_def) | {
"end_col": 128,
"end_line": 126,
"start_col": 45,
"start_line": 126
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def | let le_nat64_to_bytes_reveal = | false | null | true | opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.nat64",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Prims.l_True",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.Def.Types_s.le_nat64_to_bytes",
"Vale.Def.Types_s.le_nat64_to_bytes_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_nat64_to_bytes_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_nat64_to_bytes == Vale.Def.Types_s.le_nat64_to_bytes_def) | [] | Vale.Def.Types_s.le_nat64_to_bytes_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_nat64_to_bytes == Vale.Def.Types_s.le_nat64_to_bytes_def) | {
"end_col": 120,
"end_line": 82,
"start_col": 43,
"start_line": 82
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def | let le_seq_quad32_to_bytes_reveal = | false | null | true | opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.le_seq_quad32_to_bytes",
"Vale.Def.Types_s.le_seq_quad32_to_bytes_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_seq_quad32_to_bytes_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_seq_quad32_to_bytes == Vale.Def.Types_s.le_seq_quad32_to_bytes_def) | [] | Vale.Def.Types_s.le_seq_quad32_to_bytes_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.le_seq_quad32_to_bytes == Vale.Def.Types_s.le_seq_quad32_to_bytes_def) | {
"end_col": 140,
"end_line": 101,
"start_col": 48,
"start_line": 101
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def | let be_bytes_to_quad32_reveal = | false | null | true | opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True",
"Vale.Def.Types_s.be_bytes_to_quad32",
"Vale.Def.Types_s.be_bytes_to_quad32_def"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b)) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val be_bytes_to_quad32_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.be_bytes_to_quad32 == Vale.Def.Types_s.be_bytes_to_quad32_def) | [] | Vale.Def.Types_s.be_bytes_to_quad32_reveal | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Types_s.be_bytes_to_quad32 == Vale.Def.Types_s.be_bytes_to_quad32_def) | {
"end_col": 124,
"end_line": 92,
"start_col": 44,
"start_line": 92
} |
|
Prims.Tot | val sub_wrap (#n: nat) (x y: natN n) : natN n | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n | val sub_wrap (#n: nat) (x y: natN n) : natN n
let sub_wrap (#n: nat) (x y: natN n) : natN n = | false | null | false | if x - y >= 0 then x - y else x - y + n | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Prims.nat",
"Vale.Def.Words_s.natN",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Subtraction",
"Prims.bool",
"Prims.op_Addition"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64 | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val sub_wrap (#n: nat) (x y: natN n) : natN n | [] | Vale.Def.Types_s.sub_wrap | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.natN n -> y: Vale.Def.Words_s.natN n -> Vale.Def.Words_s.natN n | {
"end_col": 94,
"end_line": 18,
"start_col": 55,
"start_line": 18
} |
Prims.Pure | val le_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b)) | val le_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True)
let le_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) = | false | null | false | seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Vale.Def.Types_s.nat32",
"Vale.Lib.Seqs_s.seq_map",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) | [] | Vale.Def.Types_s.le_bytes_to_quad32_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | {
"end_col": 65,
"end_line": 85,
"start_col": 2,
"start_line": 85
} |
Prims.Tot | val add_wrap (#n: nat) (x y: natN n) : natN n | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n | val add_wrap (#n: nat) (x y: natN n) : natN n
let add_wrap (#n: nat) (x y: natN n) : natN n = | false | null | false | if x + y < n then x + y else x + y - n | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Prims.nat",
"Vale.Def.Words_s.natN",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.bool",
"Prims.op_Subtraction"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64 | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val add_wrap (#n: nat) (x y: natN n) : natN n | [] | Vale.Def.Types_s.add_wrap | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.natN n -> y: Vale.Def.Words_s.natN n -> Vale.Def.Words_s.natN n | {
"end_col": 93,
"end_line": 17,
"start_col": 55,
"start_line": 17
} |
Prims.Pure | val le_nat64_to_bytes_def (b: nat64)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b)) | val le_nat64_to_bytes_def (b: nat64)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 8)
let le_nat64_to_bytes_def (b: nat64)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) = | false | null | false | seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Types_s.nat64",
"Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE",
"Vale.Def.Words.Seq_s.two_to_seq_LE",
"Vale.Def.Words_s.natN",
"Prims.pow2",
"Vale.Def.Words.Two_s.nat_to_two",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Prims.l_True",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_nat64_to_bytes_def (b: nat64)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) | [] | Vale.Def.Types_s.le_nat64_to_bytes_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Types_s.nat64 -> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.nat8) | {
"end_col": 60,
"end_line": 80,
"start_col": 2,
"start_line": 80
} |
FStar.Pervasives.Lemma | val le_seq_quad32_to_bytes_length (s: seq quad32)
: Lemma (ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))] | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal () | val le_seq_quad32_to_bytes_length (s: seq quad32)
: Lemma (ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
let le_seq_quad32_to_bytes_length (s: seq quad32)
: Lemma (ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))] = | false | null | true | le_seq_quad32_to_bytes_reveal () | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.le_seq_quad32_to_bytes_reveal",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.le_seq_quad32_to_bytes",
"FStar.Mul.op_Star",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.nat",
"Prims.Nil"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))] | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_seq_quad32_to_bytes_length (s: seq quad32)
: Lemma (ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))] | [] | Vale.Def.Types_s.le_seq_quad32_to_bytes_length | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq Vale.Def.Types_s.quad32
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.length (Vale.Def.Types_s.le_seq_quad32_to_bytes s) ==
16 * FStar.Seq.Base.length s)
[SMTPat (FStar.Seq.Base.length (Vale.Def.Types_s.le_seq_quad32_to_bytes s))] | {
"end_col": 34,
"end_line": 107,
"start_col": 2,
"start_line": 107
} |
Prims.Pure | val le_quad32_to_bytes (b: quad32)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b)) | val le_quad32_to_bytes (b: quad32)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 16)
let le_quad32_to_bytes (b: quad32)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) = | false | null | false | seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Vale.Def.Types_s.nat8",
"Vale.Lib.Seqs_s.seq_map",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Four_s.nat_to_four",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"FStar.Seq.Base.seq",
"Prims.l_True",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"] | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_quad32_to_bytes (b: quad32)
: Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) | [] | Vale.Def.Types_s.le_quad32_to_bytes | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.Def.Types_s.quad32 -> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.nat8) | {
"end_col": 65,
"end_line": 96,
"start_col": 2,
"start_line": 96
} |
Prims.Pure | val be_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b)) | val be_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True)
let be_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) = | false | null | false | seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Seq_s.seq_to_four_BE",
"Vale.Def.Types_s.nat32",
"Vale.Lib.Seqs_s.seq_map",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val be_bytes_to_quad32_def (b: seq nat8)
: Pure quad32 (requires length b == 16) (ensures fun _ -> True) | [] | Vale.Def.Types_s.be_bytes_to_quad32_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.quad32 | {
"end_col": 65,
"end_line": 90,
"start_col": 2,
"start_line": 90
} |
Prims.Pure | val be_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b) | val be_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True)
let be_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) = | false | null | false | seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_BE",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"] | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val be_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) | [] | Vale.Def.Types_s.be_bytes_to_seq_quad32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8
-> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.quad32) | {
"end_col": 49,
"end_line": 115,
"start_col": 2,
"start_line": 115
} |
Prims.Pure | val le_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b) | val le_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True)
let le_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) = | false | null | false | seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE",
"Vale.Def.Types_s.quad32",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"] | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_seq_quad32 (b: seq nat8)
: Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) | [] | Vale.Def.Types_s.le_bytes_to_seq_quad32 | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8
-> Prims.Pure (FStar.Seq.Base.seq Vale.Def.Types_s.quad32) | {
"end_col": 49,
"end_line": 111,
"start_col": 2,
"start_line": 111
} |
Prims.Tot | val reverse_bytes_nat32_def (n: nat32) : nat32 | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat32_def (n:nat32) : nat32 =
be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n)) | val reverse_bytes_nat32_def (n: nat32) : nat32
let reverse_bytes_nat32_def (n: nat32) : nat32 = | false | null | false | be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.be_bytes_to_nat32",
"Vale.Lib.Seqs_s.reverse_seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.nat32_to_be_bytes"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b) | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat32_def (n: nat32) : nat32 | [] | Vale.Def.Types_s.reverse_bytes_nat32_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Vale.Def.Types_s.nat32 -> Vale.Def.Types_s.nat32 | {
"end_col": 55,
"end_line": 118,
"start_col": 2,
"start_line": 118
} |
Prims.Pure | val le_bytes_to_nat64_def (b: seq nat8)
: Pure nat64 (requires length b == 8) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b)) | val le_bytes_to_nat64_def (b: seq nat8)
: Pure nat64 (requires length b == 8) (ensures fun _ -> True)
let le_bytes_to_nat64_def (b: seq nat8)
: Pure nat64 (requires length b == 8) (ensures fun _ -> True) = | false | null | false | two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Vale.Def.Words.Two_s.two_to_nat",
"Vale.Def.Words.Seq_s.seq_to_two_LE",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE",
"Vale.Def.Types_s.nat64",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b) | false | false | Vale.Def.Types_s.fst | {
"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"
} | null | val le_bytes_to_nat64_def (b: seq nat8)
: Pure nat64 (requires length b == 8) (ensures fun _ -> True) | [] | Vale.Def.Types_s.le_bytes_to_nat64_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Prims.Pure Vale.Def.Types_s.nat64 | {
"end_col": 60,
"end_line": 75,
"start_col": 2,
"start_line": 75
} |
Prims.Tot | val reverse_bytes_nat64_def (n: nat64) : nat64 | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_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": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse_bytes_nat64_def (n:nat64) : nat64 =
let Mktwo n0 n1 = nat_to_two 32 n in
two_to_nat 32 (Mktwo (reverse_bytes_nat32 n1) (reverse_bytes_nat32 n0)) | val reverse_bytes_nat64_def (n: nat64) : nat64
let reverse_bytes_nat64_def (n: nat64) : nat64 = | false | null | false | let Mktwo n0 n1 = nat_to_two 32 n in
two_to_nat 32 (Mktwo (reverse_bytes_nat32 n1) (reverse_bytes_nat32 n0)) | {
"checked_file": "Vale.Def.Types_s.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Def.Types_s.fst"
} | [
"total"
] | [
"Vale.Def.Types_s.nat64",
"Vale.Def.Words_s.natN",
"Prims.pow2",
"Vale.Def.Words.Two_s.two_to_nat",
"Vale.Def.Words_s.Mktwo",
"Vale.Def.Types_s.reverse_bytes_nat32",
"Vale.Def.Words_s.two",
"Vale.Def.Words.Two_s.nat_to_two"
] | [] | module Vale.Def.Types_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Lib.Seqs_s
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
let add_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x + y < n then x + y else x + y - n
let sub_wrap (#n:nat) (x:natN n) (y:natN n) : natN n = if x - y >= 0 then x - y else x - y + n
// abstract bitwise operations on integers:
assume val iand : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ixor : #n:nat -> a:natN n -> b:natN n -> natN n
assume val ior : #n:nat -> a:natN n -> b:natN n -> natN n
assume val inot : #n:nat -> a:natN n -> natN n
assume val ishl : #n:nat -> a:natN n -> s:int -> natN n
assume val ishr : #n:nat -> a:natN n -> s:int -> natN n
// Alias
unfold let nat32_xor (x y:nat32) : nat32 = ixor x y
type twobits:eqtype = natN 4
type bits_of_byte:eqtype = four twobits
let byte_to_twobits (b:nat8) : bits_of_byte = nat_to_four_unfold 2 b
type double32:eqtype = two nat32
type quad32:eqtype = four nat32
let quad32_xor_def (x y:quad32) : quad32 = four_map2 nat32_xor x y
[@"opaque_to_smt"] let quad32_xor = opaque_make quad32_xor_def
irreducible let quad32_xor_reveal = opaque_revealer (`%quad32_xor) quad32_xor quad32_xor_def
let select_word (q:quad32) (selector:twobits) : nat32 = four_select q selector
let insert_nat32 (q:quad32) (n:nat32) (i:twobits) : quad32 = four_insert q n i
let insert_nat64_def (q:quad32) (n:nat64) (i:nat1) : quad32 =
two_two_to_four (two_insert (four_to_two_two q) (nat_to_two 32 n) i)
[@"opaque_to_smt"] let insert_nat64 = opaque_make insert_nat64_def
irreducible let insert_nat64_reveal = opaque_revealer (`%insert_nat64) insert_nat64 insert_nat64_def
open FStar.Seq
let le_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_LE b)
let nat32_to_le_bytes (n:nat32) : b:seq4 nat8 {
le_bytes_to_nat32 b == n} =
let b = four_to_seq_LE (nat_to_four 8 n) in
assume (le_bytes_to_nat32 b == n);
b
let be_bytes_to_nat32 (b:seq4 nat8) : nat32 =
four_to_nat 8 (seq_to_four_BE b)
let nat32_to_be_bytes (n:nat32) : b:seq4 nat8 { be_bytes_to_nat32 b == n } =
let b = four_to_seq_BE (nat_to_four 8 n) in
assume (be_bytes_to_nat32 b == n);
b
assume val be_bytes_to_nat32_to_be_bytes (b:seq4 nat8) :
Lemma (nat32_to_be_bytes (be_bytes_to_nat32 b) == b)
let le_bytes_to_nat64_def (b:seq nat8) : Pure nat64 (requires length b == 8) (ensures fun _ -> True) =
two_to_nat 32 (seq_to_two_LE (seq_nat8_to_seq_nat32_LE b))
[@"opaque_to_smt"] let le_bytes_to_nat64 = opaque_make le_bytes_to_nat64_def
irreducible let le_bytes_to_nat64_reveal = opaque_revealer (`%le_bytes_to_nat64) le_bytes_to_nat64 le_bytes_to_nat64_def
let le_nat64_to_bytes_def (b:nat64) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 8) =
seq_nat32_to_seq_nat8_LE (two_to_seq_LE (nat_to_two 32 b))
[@"opaque_to_smt"] let le_nat64_to_bytes = opaque_make le_nat64_to_bytes_def
irreducible let le_nat64_to_bytes_reveal = opaque_revealer (`%le_nat64_to_bytes) le_nat64_to_bytes le_nat64_to_bytes_def
let le_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_LE (seq_map (four_to_nat 8) (seq_to_seq_four_LE b))
[@"opaque_to_smt"] let le_bytes_to_quad32 = opaque_make le_bytes_to_quad32_def
irreducible let le_bytes_to_quad32_reveal = opaque_revealer (`%le_bytes_to_quad32) le_bytes_to_quad32 le_bytes_to_quad32_def
let be_bytes_to_quad32_def (b:seq nat8) : Pure quad32 (requires length b == 16) (ensures fun _ -> True) =
seq_to_four_BE (seq_map (four_to_nat 8) (seq_to_seq_four_BE b))
[@"opaque_to_smt"] let be_bytes_to_quad32 = opaque_make be_bytes_to_quad32_def
irreducible let be_bytes_to_quad32_reveal = opaque_revealer (`%be_bytes_to_quad32) be_bytes_to_quad32 be_bytes_to_quad32_def
[@"opaque_to_smt"]
let le_quad32_to_bytes (b:quad32) : Pure (seq nat8) (requires True) (ensures fun s -> length s == 16) =
seq_four_to_seq_LE (seq_map (nat_to_four 8) (four_to_seq_LE b))
let le_seq_quad32_to_bytes_def (b:seq quad32) : seq nat8 =
seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE b)
[@"opaque_to_smt"] let le_seq_quad32_to_bytes = opaque_make le_seq_quad32_to_bytes_def
irreducible let le_seq_quad32_to_bytes_reveal = opaque_revealer (`%le_seq_quad32_to_bytes) le_seq_quad32_to_bytes le_seq_quad32_to_bytes_def
let le_seq_quad32_to_bytes_length (s:seq quad32) : Lemma
(ensures length (le_seq_quad32_to_bytes s) == 16 * (length s))
[SMTPat (length (le_seq_quad32_to_bytes s))]
=
le_seq_quad32_to_bytes_reveal ()
[@"opaque_to_smt"]
let le_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_LE (seq_nat8_to_seq_nat32_LE b)
[@"opaque_to_smt"]
let be_bytes_to_seq_quad32 (b:seq nat8) : Pure (seq quad32) (requires length b % 16 == 0) (ensures fun _ -> True) =
seq_to_seq_four_BE (seq_nat8_to_seq_nat32_BE b)
let reverse_bytes_nat32_def (n:nat32) : nat32 =
be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes n))
[@"opaque_to_smt"] let reverse_bytes_nat32 = opaque_make reverse_bytes_nat32_def
irreducible let reverse_bytes_nat32_reveal = opaque_revealer (`%reverse_bytes_nat32) reverse_bytes_nat32 reverse_bytes_nat32_def | false | true | Vale.Def.Types_s.fst | {
"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"
} | null | val reverse_bytes_nat64_def (n: nat64) : nat64 | [] | Vale.Def.Types_s.reverse_bytes_nat64_def | {
"file_name": "vale/specs/defs/Vale.Def.Types_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Vale.Def.Types_s.nat64 -> Vale.Def.Types_s.nat64 | {
"end_col": 73,
"end_line": 124,
"start_col": 47,
"start_line": 122
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res)) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij) | val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res = | true | null | false | let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij) | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Prims.op_LessThan",
"Hacl.Impl.Matrix.lbytes",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"Hacl.Impl.Matrix.matrix_t",
"Hacl.Impl.Matrix.mset",
"Prims.unit",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U16",
"Lib.IntTypes.SEC",
"Lib.ByteBuffer.uint_from_bytes_le",
"Lib.IntTypes.uint_t",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.U8",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub",
"Lib.IntTypes.uint8"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res)) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res)) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake0 | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
2 * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t } ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v n} ->
r: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
j: Lib.IntTypes.size_t{Lib.IntTypes.v j < Lib.IntTypes.v n} ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 41,
"end_line": 41,
"start_col": 41,
"start_line": 39
} |
FStar.HyperStack.ST.Stack | val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16) | val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i = | true | null | false | let h0 = ST.get () in
update_sub_f h0
tmp_seed
0ul
2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro (as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16) | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Hacl.Impl.Matrix.lbytes",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Lib.Sequence.eq_intro",
"Lib.IntTypes.uint8",
"Lib.Sequence.sub",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.unit",
"Lib.Sequence.concat",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.numbytes",
"Lib.ByteSequence.uint_to_bytes_le",
"Lib.IntTypes.to_u16",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.update_sub_f",
"Lib.Sequence.lseq",
"Lib.ByteBuffer.uint_to_bytes_le",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | [] | Hacl.Impl.Frodo.Gen.concat_ind_seed | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tmp_seed: Hacl.Impl.Matrix.lbytes 18ul ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.maxint Lib.IntTypes.U16}
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 89,
"end_line": 63,
"start_col": 32,
"start_line": 54
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
) | val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res = | true | null | false | concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@@ inline_let ]let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0
n
res
spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res) | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Hacl.Impl.Matrix.lbytes",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"Prims.op_LessThan",
"Hacl.Impl.Matrix.matrix_t",
"Lib.Buffer.loop1",
"Hacl.Impl.Matrix.elem",
"Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake0",
"Prims.unit",
"Lib.LoopCombinators.unfold_repeati",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Hacl.Impl.Matrix.as_matrix",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Prims.nat",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Frodo.Gen.frodo_gen_matrix_shake0",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint8",
"Hacl.SHA3.shake128_hacl",
"Hacl.Impl.Frodo.Gen.concat_ind_seed"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake1 | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 } ->
tmp_seed: Hacl.Impl.Matrix.lbytes 18ul ->
r: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v n} ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 3,
"end_line": 92,
"start_col": 2,
"start_line": 82
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res)) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res =
let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3) | val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res = | true | null | false | let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3) | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Prims.op_LessThan",
"Prims.op_Division",
"Hacl.Impl.Matrix.lbytes",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"Hacl.Impl.Matrix.matrix_t",
"Hacl.Impl.Matrix.mset",
"Lib.IntTypes.op_Plus_Bang",
"Prims.unit",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.ByteBuffer.uint_from_bytes_le",
"Lib.IntTypes.uint_t",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.U8",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub",
"Lib.IntTypes.uint8"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"]
let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame ()
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res)) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res)) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x0 | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 } ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v n / 4} ->
r0: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
r1: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
r2: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
r3: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 2 *! n) ->
j: Lib.IntTypes.size_t{Lib.IntTypes.v j < Lib.IntTypes.v n} ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 64,
"end_line": 161,
"start_col": 54,
"start_line": 153
} |
Prims.Tot | val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0 | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tmp_seed4_pre h tmp_seed =
let seed0 = LSeq.sub (as_seq h tmp_seed) 2 16 in
let seed1 = LSeq.sub (as_seq h tmp_seed) 20 16 in
let seed2 = LSeq.sub (as_seq h tmp_seed) 38 16 in
let seed3 = LSeq.sub (as_seq h tmp_seed) 56 16 in
seed0 == seed1 /\ seed0 == seed2 /\ seed0 == seed3 | val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0
let tmp_seed4_pre h tmp_seed = | false | null | false | let seed0 = LSeq.sub (as_seq h tmp_seed) 2 16 in
let seed1 = LSeq.sub (as_seq h tmp_seed) 20 16 in
let seed2 = LSeq.sub (as_seq h tmp_seed) 38 16 in
let seed3 = LSeq.sub (as_seq h tmp_seed) 56 16 in
seed0 == seed1 /\ seed0 == seed2 /\ seed0 == seed3 | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [
"total"
] | [
"FStar.Monotonic.HyperStack.mem",
"Hacl.Impl.Matrix.lbytes",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.UInt32.__uint_to_t",
"Prims.l_and",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.uint8",
"Prims.l_or",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.op_Addition",
"Prims.l_Forall",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.mul",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Sequence.sub"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"]
let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame ()
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res =
let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0 | [] | Hacl.Impl.Frodo.Gen.tmp_seed4_pre | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: FStar.Monotonic.HyperStack.mem -> tmp_seed: Hacl.Impl.Matrix.lbytes (18ul *! 4ul) -> Type0 | {
"end_col": 52,
"end_line": 170,
"start_col": 30,
"start_line": 165
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake_4x1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r:lbytes (size 8 *! n)
-> i:size_t{v i < v n / 4}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake_4x1 n tmp_seed r i res =
let r0 = sub r (size 0 *! n) (size 2 *! n) in
let r1 = sub r (size 2 *! n) (size 2 *! n) in
let r2 = sub r (size 4 *! n) (size 2 *! n) in
let r3 = sub r (size 6 *! n) (size 2 *! n) in
frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i;
[@inline_let]
let spec h0 = S.frodo_gen_matrix_shake_4x0 (v n) (v i)
(as_seq h0 r0) (as_seq h0 r1) (as_seq h0 r2) (as_seq h0 r3) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res
) | val frodo_gen_matrix_shake_4x1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r:lbytes (size 8 *! n)
-> i:size_t{v i < v n / 4}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed)
let frodo_gen_matrix_shake_4x1 n tmp_seed r i res = | true | null | false | let r0 = sub r (size 0 *! n) (size 2 *! n) in
let r1 = sub r (size 2 *! n) (size 2 *! n) in
let r2 = sub r (size 4 *! n) (size 2 *! n) in
let r3 = sub r (size 6 *! n) (size 2 *! n) in
frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i;
[@@ inline_let ]let spec h0 =
S.frodo_gen_matrix_shake_4x0 (v n)
(v i)
(as_seq h0 r0)
(as_seq h0 r1)
(as_seq h0 r2)
(as_seq h0 r3)
in
let h0 = ST.get () in
loop1 h0
n
res
spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res) | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Hacl.Impl.Matrix.lbytes",
"Lib.IntTypes.op_Star_Bang",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size",
"Prims.op_LessThan",
"Prims.op_Division",
"Hacl.Impl.Matrix.matrix_t",
"Lib.Buffer.loop1",
"Hacl.Impl.Matrix.elem",
"Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x0",
"Prims.unit",
"Lib.LoopCombinators.unfold_repeati",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Hacl.Impl.Matrix.as_matrix",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Prims.nat",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Frodo.Gen.frodo_gen_matrix_shake_4x0",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint8",
"Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x1_get_r",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"]
let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame ()
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res =
let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3)
val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0
let tmp_seed4_pre h tmp_seed =
let seed0 = LSeq.sub (as_seq h tmp_seed) 2 16 in
let seed1 = LSeq.sub (as_seq h tmp_seed) 20 16 in
let seed2 = LSeq.sub (as_seq h tmp_seed) 38 16 in
let seed3 = LSeq.sub (as_seq h tmp_seed) 56 16 in
seed0 == seed1 /\ seed0 == seed2 /\ seed0 == seed3
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed)
let frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i =
let tmp_seed0 = sub tmp_seed 0ul 18ul in
let tmp_seed1 = sub tmp_seed 18ul 18ul in
let tmp_seed2 = sub tmp_seed 36ul 18ul in
let tmp_seed3 = sub tmp_seed 54ul 18ul in
concat_ind_seed tmp_seed0 (4ul *! i +! 0ul);
concat_ind_seed tmp_seed1 (4ul *! i +! 1ul);
concat_ind_seed tmp_seed2 (4ul *! i +! 2ul);
concat_ind_seed tmp_seed3 (4ul *! i +! 3ul);
Hacl.Keccak.shake128_4x 18ul tmp_seed0 tmp_seed1 tmp_seed2 tmp_seed3 (size 2 *! n) r0 r1 r2 r3
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r:lbytes (size 8 *! n)
-> i:size_t{v i < v n / 4}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake_4x1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r:lbytes (size 8 *! n)
-> i:size_t{v i < v n / 4}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x1 | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 } ->
tmp_seed: Hacl.Impl.Matrix.lbytes (18ul *! 4ul) ->
r: Hacl.Impl.Matrix.lbytes (Lib.IntTypes.size 8 *! n) ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v n / 4} ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 3,
"end_line": 235,
"start_col": 51,
"start_line": 220
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i =
let tmp_seed0 = sub tmp_seed 0ul 18ul in
let tmp_seed1 = sub tmp_seed 18ul 18ul in
let tmp_seed2 = sub tmp_seed 36ul 18ul in
let tmp_seed3 = sub tmp_seed 54ul 18ul in
concat_ind_seed tmp_seed0 (4ul *! i +! 0ul);
concat_ind_seed tmp_seed1 (4ul *! i +! 1ul);
concat_ind_seed tmp_seed2 (4ul *! i +! 2ul);
concat_ind_seed tmp_seed3 (4ul *! i +! 3ul);
Hacl.Keccak.shake128_4x 18ul tmp_seed0 tmp_seed1 tmp_seed2 tmp_seed3 (size 2 *! n) r0 r1 r2 r3 | val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed)
let frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i = | true | null | false | let tmp_seed0 = sub tmp_seed 0ul 18ul in
let tmp_seed1 = sub tmp_seed 18ul 18ul in
let tmp_seed2 = sub tmp_seed 36ul 18ul in
let tmp_seed3 = sub tmp_seed 54ul 18ul in
concat_ind_seed tmp_seed0 (4ul *! i +! 0ul);
concat_ind_seed tmp_seed1 (4ul *! i +! 1ul);
concat_ind_seed tmp_seed2 (4ul *! i +! 2ul);
concat_ind_seed tmp_seed3 (4ul *! i +! 3ul);
Hacl.Keccak.shake128_4x 18ul tmp_seed0 tmp_seed1 tmp_seed2 tmp_seed3 (size 2 *! n) r0 r1 r2 r3 | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Hacl.Impl.Matrix.lbytes",
"Lib.IntTypes.op_Star_Bang",
"FStar.UInt32.__uint_to_t",
"Prims.op_LessThan",
"Prims.op_Division",
"Hacl.Keccak.shake128_4x",
"Lib.IntTypes.size",
"Prims.unit",
"Hacl.Impl.Frodo.Gen.concat_ind_seed",
"Lib.IntTypes.op_Plus_Bang",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Lib.IntTypes.uint8"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"]
let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame ()
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res =
let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3)
val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0
let tmp_seed4_pre h tmp_seed =
let seed0 = LSeq.sub (as_seq h tmp_seed) 2 16 in
let seed1 = LSeq.sub (as_seq h tmp_seed) 20 16 in
let seed2 = LSeq.sub (as_seq h tmp_seed) 38 16 in
let seed3 = LSeq.sub (as_seq h tmp_seed) 56 16 in
seed0 == seed1 /\ seed0 == seed2 /\ seed0 == seed3
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x1_get_r | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 } ->
tmp_seed: Hacl.Impl.Matrix.lbytes (18ul *! 4ul) ->
r0: Hacl.Impl.Matrix.lbytes (2ul *! n) ->
r1: Hacl.Impl.Matrix.lbytes (2ul *! n) ->
r2: Hacl.Impl.Matrix.lbytes (2ul *! n) ->
r3: Hacl.Impl.Matrix.lbytes (2ul *! n) ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v n / 4}
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 96,
"end_line": 201,
"start_col": 63,
"start_line": 191
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed)) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame () | val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
let frodo_gen_matrix_shake n seed res = | true | null | false | push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@@ inline_let ]let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@@ inline_let ]let inv h (i: nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res)
in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul
n
inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame () | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Hacl.Impl.Matrix.lbytes",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Matrix.matrix_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.Loops.for",
"Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake1",
"Lib.LoopCombinators.unfold_repeati",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Impl.Matrix.elem",
"Lib.IntTypes.op_Star_Bang",
"Lib.LoopCombinators.eq_repeati0",
"FStar.Monotonic.HyperStack.mem",
"Prims.nat",
"Prims.logical",
"Lib.Buffer.modifies",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.Buffer.loc",
"Lib.IntTypes.uint8",
"Prims.eq2",
"Prims.l_or",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Prims.l_Forall",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.Sequence.sub",
"Lib.Sequence.seq",
"FStar.Seq.Base.length",
"Lib.LoopCombinators.repeati",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Frodo.Gen.frodo_gen_matrix_shake1",
"Lib.Sequence.eq_intro",
"FStar.HyperStack.ST.get",
"Lib.Buffer.memset",
"Lib.IntTypes.u16",
"Lib.Buffer.copy",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.U8",
"FStar.UInt32.uint_to_t",
"Lib.Buffer.sub",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.size",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"] | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed)) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ 0 < Lib.IntTypes.v n /\ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 } ->
seed: Hacl.Impl.Matrix.lbytes 16ul ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 14,
"end_line": 130,
"start_col": 2,
"start_line": 107
} |
FStar.HyperStack.ST.Stack | val frodo_gen_matrix_shake_4x:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16 /\ v n % 4 = 0}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed)) | [
{
"abbrev": true,
"full_module": "Hacl.SHA3",
"short_module": "SHA3"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Spec.Frodo.Gen",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_gen_matrix_shake_4x n seed res =
push_frame ();
let r = create (size 8 *! n) (u8 0) in
let tmp_seed = create 72ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
copy (sub tmp_seed 20ul 16ul) seed;
copy (sub tmp_seed 38ul 16ul) seed;
copy (sub tmp_seed 56ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
assert (tmp_seed4_pre h0 tmp_seed);
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake_4x1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n / 4}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
tmp_seed4_pre h tmp_seed /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n / 4) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul (n /. 4ul) inv
(fun i ->
Loops.unfold_repeati (v n / 4) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake_4x1 n tmp_seed r i res);
let h1 = ST.get () in
assert (as_matrix h1 res == S.frodo_gen_matrix_shake_4x (v n) (as_seq h0 seed));
S.frodo_gen_matrix_shake_4x_lemma (v n) (as_seq h0 seed);
pop_frame () | val frodo_gen_matrix_shake_4x:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16 /\ v n % 4 = 0}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
let frodo_gen_matrix_shake_4x n seed res = | true | null | false | push_frame ();
let r = create (size 8 *! n) (u8 0) in
let tmp_seed = create 72ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
copy (sub tmp_seed 20ul 16ul) seed;
copy (sub tmp_seed 38ul 16ul) seed;
copy (sub tmp_seed 56ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
assert (tmp_seed4_pre h0 tmp_seed);
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@@ inline_let ]let spec h0 = S.frodo_gen_matrix_shake_4x1 (v n) (as_seq h0 seed) in
[@@ inline_let ]let inv h (i: nat{i <= v n / 4}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
tmp_seed4_pre h tmp_seed /\ as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res)
in
Loops.eq_repeati0 (v n / 4) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul
(n /. 4ul)
inv
(fun i ->
Loops.unfold_repeati (v n / 4) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake_4x1 n tmp_seed r i res);
let h1 = ST.get () in
assert (as_matrix h1 res == S.frodo_gen_matrix_shake_4x (v n) (as_seq h0 seed));
S.frodo_gen_matrix_shake_4x_lemma (v n) (as_seq h0 seed);
pop_frame () | {
"checked_file": "Hacl.Impl.Frodo.Gen.fst.checked",
"dependencies": [
"Spec.Frodo.Lemmas.fst.checked",
"Spec.Frodo.Gen.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.Loops.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"Hacl.Keccak.fsti.checked",
"Hacl.Impl.Matrix.fst.checked",
"Hacl.AES128.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Frodo.Gen.fst"
} | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U16",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Hacl.Impl.Matrix.lbytes",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Matrix.matrix_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Spec.Frodo.Gen.frodo_gen_matrix_shake_4x_lemma",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint8",
"Prims._assert",
"Prims.eq2",
"Spec.Matrix.matrix",
"Hacl.Impl.Matrix.as_matrix",
"Spec.Frodo.Gen.frodo_gen_matrix_shake_4x",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Loops.for",
"Lib.IntTypes.op_Slash_Dot",
"Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x1",
"Lib.LoopCombinators.unfold_repeati",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Prims.op_Division",
"Hacl.Impl.Matrix.elem",
"Lib.IntTypes.op_Star_Bang",
"Lib.LoopCombinators.eq_repeati0",
"Prims.nat",
"Prims.logical",
"Lib.Buffer.modifies",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.Buffer.loc",
"Prims.l_or",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Prims.l_Forall",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.Sequence.sub",
"Hacl.Impl.Frodo.Gen.tmp_seed4_pre",
"Lib.Sequence.seq",
"FStar.Seq.Base.length",
"Lib.LoopCombinators.repeati",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Frodo.Gen.frodo_gen_matrix_shake_4x1",
"Lib.Sequence.eq_intro",
"Lib.Buffer.memset",
"Lib.IntTypes.u16",
"Lib.Buffer.copy",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.U8",
"FStar.UInt32.uint_to_t",
"Lib.Buffer.sub",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.size",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Frodo.Gen
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open LowStar.Buffer
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Matrix
module ST = FStar.HyperStack.ST
module B = LowStar.Buffer
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Loops = Lib.LoopCombinators
module S = Spec.Frodo.Gen
module Lemmas = Spec.Frodo.Lemmas
module SHA3 = Hacl.SHA3
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract private
val frodo_gen_matrix_shake0:
n:size_t{v n * v n <= max_size_t /\ 2 * v n <= max_size_t}
-> i:size_t{v i < v n}
-> r:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> live h r /\ live h res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake0 n i r j res =
let resij = sub r (size 2 *! j) (size 2) in
mset res i j (uint_from_bytes_le resij)
inline_for_extraction noextract private
val concat_ind_seed:
tmp_seed:lbytes 18ul
-> i:size_t{v i < maxint U16}
-> Stack unit
(requires fun h -> live h tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc tmp_seed) h0 h1 /\
as_seq h1 tmp_seed == LSeq.concat (BSeq.uint_to_bytes_le (u16 (v i))) (LSeq.sub (as_seq h0 tmp_seed) 2 16) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let concat_ind_seed tmp_seed i =
let h0 = ST.get () in
update_sub_f h0 tmp_seed 0ul 2ul
(fun h -> BSeq.uint_to_bytes_le (to_u16 i))
(fun _ -> uint_to_bytes_le (sub tmp_seed 0ul 2ul) (to_u16 i));
let h1 = ST.get () in
LSeq.eq_intro
(as_seq h1 tmp_seed)
(LSeq.concat (BSeq.uint_to_bytes_le (to_u16 i)) (LSeq.sub (as_seq h0 tmp_seed) 2 16));
LSeq.eq_intro (LSeq.sub (as_seq h0 tmp_seed) 2 16) (LSeq.sub (as_seq h1 tmp_seed) 2 16)
inline_for_extraction noextract private
val frodo_gen_matrix_shake1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes 18ul
-> r:lbytes (size 2 *! n)
-> i:size_t{v i < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16)
let frodo_gen_matrix_shake1 n tmp_seed r i res =
concat_ind_seed tmp_seed i;
SHA3.shake128_hacl 18ul tmp_seed (2ul *! n) r;
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake0 (v n) (v i) (as_seq h0 r) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake0 n i r j res
)
val frodo_gen_matrix_shake:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"]
let frodo_gen_matrix_shake n seed res =
push_frame ();
let r = create (size 2 *! n) (u8 0) in
let tmp_seed = create 18ul (u8 0) in
copy (sub tmp_seed 2ul 16ul) seed;
memset res (u16 0) (n *! n);
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v n * v n)) (as_seq h0 res);
[@ inline_let]
let spec h0 = S.frodo_gen_matrix_shake1 (v n) (as_seq h0 seed) in
[@ inline_let]
let inv h (i:nat{i <= v n}) =
modifies (loc res |+| loc r |+| loc tmp_seed) h0 h /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h tmp_seed) 2 16 /\
as_seq h res == Loops.repeati i (spec h0) (as_seq h0 res) in
Loops.eq_repeati0 (v n) (spec h0) (as_seq h0 res);
Lib.Loops.for 0ul n inv
(fun i ->
Loops.unfold_repeati (v n) (spec h0) (as_seq h0 res) (v i);
frodo_gen_matrix_shake1 n tmp_seed r i res);
pop_frame ()
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x0:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> i:size_t{v i < v n / 4}
-> r0:lbytes (size 2 *! n)
-> r1:lbytes (size 2 *! n)
-> r2:lbytes (size 2 *! n)
-> r3:lbytes (size 2 *! n)
-> j:size_t{v j < v n}
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h r0 /\ live h r1 /\ live h r2 /\
live h r3 /\ live h res /\
B.loc_pairwise_disjoint [loc res; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies1 res h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x0 (v n) (v i) (as_seq h0 r0) (as_seq h0 r1)
(as_seq h0 r2) (as_seq h0 r3) (v j) (as_matrix h0 res))
let frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res =
let resij0 = sub r0 (j *! size 2) (size 2) in
let resij1 = sub r1 (j *! size 2) (size 2) in
let resij2 = sub r2 (j *! size 2) (size 2) in
let resij3 = sub r3 (j *! size 2) (size 2) in
mset res (size 4 *! i +! size 0) j (uint_from_bytes_le resij0);
mset res (size 4 *! i +! size 1) j (uint_from_bytes_le resij1);
mset res (size 4 *! i +! size 2) j (uint_from_bytes_le resij2);
mset res (size 4 *! i +! size 3) j (uint_from_bytes_le resij3)
val tmp_seed4_pre: h:mem -> tmp_seed:lbytes (18ul *! 4ul) -> Type0
let tmp_seed4_pre h tmp_seed =
let seed0 = LSeq.sub (as_seq h tmp_seed) 2 16 in
let seed1 = LSeq.sub (as_seq h tmp_seed) 20 16 in
let seed2 = LSeq.sub (as_seq h tmp_seed) 38 16 in
let seed3 = LSeq.sub (as_seq h tmp_seed) 56 16 in
seed0 == seed1 /\ seed0 == seed2 /\ seed0 == seed3
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x1_get_r:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r0:lbytes (2ul *! n)
-> r1:lbytes (2ul *! n)
-> r2:lbytes (2ul *! n)
-> r3:lbytes (2ul *! n)
-> i:size_t{v i < v n / 4}
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h r0 /\ live h r1 /\ live h r2 /\ live h r3 /\
loc_pairwise_disjoint [loc tmp_seed; loc r0; loc r1; loc r2; loc r3])
(ensures fun h0 _ h1 -> modifies (loc r0 |+| loc r1 |+| loc r2 |+| loc r3 |+| loc tmp_seed) h0 h1 /\
(as_seq h1 r0, as_seq h1 r1, as_seq h1 r2, as_seq h1 r3) ==
S.frodo_gen_matrix_shake_4x1_get_r (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed)
let frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i =
let tmp_seed0 = sub tmp_seed 0ul 18ul in
let tmp_seed1 = sub tmp_seed 18ul 18ul in
let tmp_seed2 = sub tmp_seed 36ul 18ul in
let tmp_seed3 = sub tmp_seed 54ul 18ul in
concat_ind_seed tmp_seed0 (4ul *! i +! 0ul);
concat_ind_seed tmp_seed1 (4ul *! i +! 1ul);
concat_ind_seed tmp_seed2 (4ul *! i +! 2ul);
concat_ind_seed tmp_seed3 (4ul *! i +! 3ul);
Hacl.Keccak.shake128_4x 18ul tmp_seed0 tmp_seed1 tmp_seed2 tmp_seed3 (size 2 *! n) r0 r1 r2 r3
inline_for_extraction noextract private
val frodo_gen_matrix_shake_4x1:
n:size_t{v n * v n <= max_size_t /\ v n <= maxint U16}
-> tmp_seed:lbytes (18ul *! 4ul)
-> r:lbytes (size 8 *! n)
-> i:size_t{v i < v n / 4}
-> res:matrix_t n n
-> Stack unit
(requires fun h -> tmp_seed4_pre h tmp_seed /\
live h tmp_seed /\ live h res /\ live h r /\
disjoint res tmp_seed /\ disjoint res r /\ disjoint r tmp_seed)
(ensures fun h0 _ h1 -> modifies (loc res |+| loc r |+| loc tmp_seed) h0 h1 /\
as_matrix h1 res ==
S.frodo_gen_matrix_shake_4x1 (v n) (LSeq.sub (as_seq h0 tmp_seed) 2 16) (v i) (as_matrix h0 res) /\
LSeq.sub (as_seq h0 tmp_seed) 2 16 == LSeq.sub (as_seq h1 tmp_seed) 2 16 /\ tmp_seed4_pre h1 tmp_seed)
let frodo_gen_matrix_shake_4x1 n tmp_seed r i res =
let r0 = sub r (size 0 *! n) (size 2 *! n) in
let r1 = sub r (size 2 *! n) (size 2 *! n) in
let r2 = sub r (size 4 *! n) (size 2 *! n) in
let r3 = sub r (size 6 *! n) (size 2 *! n) in
frodo_gen_matrix_shake_4x1_get_r n tmp_seed r0 r1 r2 r3 i;
[@inline_let]
let spec h0 = S.frodo_gen_matrix_shake_4x0 (v n) (v i)
(as_seq h0 r0) (as_seq h0 r1) (as_seq h0 r2) (as_seq h0 r3) in
let h0 = ST.get () in
loop1 h0 n res spec
(fun j ->
Loops.unfold_repeati (v n) (spec h0) (as_matrix h0 res) (v j);
frodo_gen_matrix_shake_4x0 n i r0 r1 r2 r3 j res
)
val frodo_gen_matrix_shake_4x:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16 /\ v n % 4 = 0}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed))
[@"c_inline"] | false | false | Hacl.Impl.Frodo.Gen.fst | {
"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"
} | null | val frodo_gen_matrix_shake_4x:
n:size_t{0 < v n /\ v n * v n <= max_size_t /\ v n <= maxint U16 /\ v n % 4 = 0}
-> seed:lbytes 16ul
-> res:matrix_t n n
-> Stack unit
(requires fun h ->
live h seed /\ live h res /\ disjoint seed res)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_matrix h1 res == S.frodo_gen_matrix_shake (v n) (as_seq h0 seed)) | [] | Hacl.Impl.Frodo.Gen.frodo_gen_matrix_shake_4x | {
"file_name": "code/frodo/Hacl.Impl.Frodo.Gen.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n:
Lib.IntTypes.size_t
{ 0 < Lib.IntTypes.v n /\ Lib.IntTypes.v n * Lib.IntTypes.v n <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v n <= Lib.IntTypes.maxint Lib.IntTypes.U16 /\ Lib.IntTypes.v n % 4 = 0 } ->
seed: Hacl.Impl.Matrix.lbytes 16ul ->
res: Hacl.Impl.Matrix.matrix_t n n
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 14,
"end_line": 281,
"start_col": 2,
"start_line": 250
} |
Prims.Tot | val size (a: poly) : int | [
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let size (a:poly) : int = degree a + 1 | val size (a: poly) : int
let size (a: poly) : int = | false | null | false | degree a + 1 | {
"checked_file": "Vale.Math.Poly2.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Prims.op_Addition",
"Vale.Math.Poly2_s.degree",
"Prims.int"
] | [] | module Vale.Math.Poly2
open FStar.Mul
open FStar.Seq
open Vale.Math.Poly2_s
// Fundamental lemmas
// (derived lemmas should go in Vale.Math.Poly2.Lemmas_i)
unfold let ( +. ) = add
unfold let ( *. ) = mul
unfold let ( /. ) = div
unfold let ( %. ) = mod | false | true | Vale.Math.Poly2.fsti | {
"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"
} | null | val size (a: poly) : int | [] | Vale.Math.Poly2.size | {
"file_name": "vale/code/lib/math/Vale.Math.Poly2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> Prims.int | {
"end_col": 38,
"end_line": 14,
"start_col": 26,
"start_line": 14
} |
Prims.Tot | val swap (a: poly) (n: nat) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Math.Poly2.Defs",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Math.Poly2.Defs_s",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let swap (a:poly) (n:nat) : poly =
shift (mask a n) n +. shift a (-n) | val swap (a: poly) (n: nat) : poly
let swap (a: poly) (n: nat) : poly = | false | null | false | shift (mask a n) n +. shift a (- n) | {
"checked_file": "Vale.Math.Poly2.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Vale.Math.Poly2.op_Plus_Dot",
"Vale.Math.Poly2_s.shift",
"Vale.Math.Poly2.mask",
"Prims.op_Minus"
] | [] | module Vale.Math.Poly2
open FStar.Mul
open FStar.Seq
open Vale.Math.Poly2_s
// Fundamental lemmas
// (derived lemmas should go in Vale.Math.Poly2.Lemmas_i)
unfold let ( +. ) = add
unfold let ( *. ) = mul
unfold let ( /. ) = div
unfold let ( %. ) = mod
let size (a:poly) : int = degree a + 1
val poly_and (a:poly) (b:poly) : poly
val poly_or (a:poly) (b:poly) : poly
// Keep terms up to degree < n, drop terms of degree >= n
val mask (a:poly) (n:nat) : poly | false | true | Vale.Math.Poly2.fsti | {
"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"
} | null | val swap (a: poly) (n: nat) : poly | [] | Vale.Math.Poly2.swap | {
"file_name": "vale/code/lib/math/Vale.Math.Poly2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> n: Prims.nat -> Vale.Math.Poly2_s.poly | {
"end_col": 36,
"end_line": 23,
"start_col": 2,
"start_line": 23
} |
Prims.Tot | val power (a: poly) (n: nat) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Math.Poly2.Defs",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Math.Poly2.Defs_s",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec power (a:poly) (n:nat) : poly =
if n = 0 then one else a *. power a (n - 1) | val power (a: poly) (n: nat) : poly
let rec power (a: poly) (n: nat) : poly = | false | null | false | if n = 0 then one else a *. power a (n - 1) | {
"checked_file": "Vale.Math.Poly2.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Vale.Math.Poly2_s.one",
"Prims.bool",
"Vale.Math.Poly2.op_Star_Dot",
"Vale.Math.Poly2.power",
"Prims.op_Subtraction"
] | [] | module Vale.Math.Poly2
open FStar.Mul
open FStar.Seq
open Vale.Math.Poly2_s
// Fundamental lemmas
// (derived lemmas should go in Vale.Math.Poly2.Lemmas_i)
unfold let ( +. ) = add
unfold let ( *. ) = mul
unfold let ( /. ) = div
unfold let ( %. ) = mod
let size (a:poly) : int = degree a + 1
val poly_and (a:poly) (b:poly) : poly
val poly_or (a:poly) (b:poly) : poly
// Keep terms up to degree < n, drop terms of degree >= n
val mask (a:poly) (n:nat) : poly
let swap (a:poly) (n:nat) : poly =
shift (mask a n) n +. shift a (-n)
// n 1 bits (ones.[0] && ... && ones.[n - 1])
val ones (n:nat) : poly | false | true | Vale.Math.Poly2.fsti | {
"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"
} | null | val power (a: poly) (n: nat) : poly | [
"recursion"
] | Vale.Math.Poly2.power | {
"file_name": "vale/code/lib/math/Vale.Math.Poly2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> n: Prims.nat -> Vale.Math.Poly2_s.poly | {
"end_col": 45,
"end_line": 29,
"start_col": 2,
"start_line": 29
} |
Prims.GTot | val serialize_all_bytes' (input: B32.bytes) : GTot bytes | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input | val serialize_all_bytes' (input: B32.bytes) : GTot bytes
let serialize_all_bytes' (input: B32.bytes) : GTot bytes = | false | null | false | B32.reveal input | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"sometrivial"
] | [
"FStar.Bytes.bytes",
"FStar.Bytes.reveal",
"LowParse.Bytes.bytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_all_bytes' (input: B32.bytes) : GTot bytes | [] | LowParse.Spec.Bytes.serialize_all_bytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | input: FStar.Bytes.bytes -> Prims.GTot LowParse.Bytes.bytes | {
"end_col": 18,
"end_line": 122,
"start_col": 2,
"start_line": 122
} |
Prims.Tot | val serialize_flbytes' (sz: nat{sz < 4294967296}) : Tot (bare_serializer (B32.lbytes sz)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
) | val serialize_flbytes' (sz: nat{sz < 4294967296}) : Tot (bare_serializer (B32.lbytes sz))
let serialize_flbytes' (sz: nat{sz < 4294967296}) : Tot (bare_serializer (B32.lbytes sz)) = | false | null | false | fun (x: B32.lbytes sz) ->
(lt_pow2_32 sz;
B32.reveal x) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Bytes.lbytes",
"FStar.Bytes.reveal",
"Prims.unit",
"LowParse.Spec.Bytes.lt_pow2_32",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.bare_serializer"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_flbytes' (sz: nat{sz < 4294967296}) : Tot (bare_serializer (B32.lbytes sz)) | [] | LowParse.Spec.Bytes.serialize_flbytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | sz: Prims.nat{sz < 4294967296} -> LowParse.Spec.Base.bare_serializer (FStar.Bytes.lbytes sz) | {
"end_col": 3,
"end_line": 36,
"start_col": 2,
"start_line": 33
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
} | let parse_all_bytes_kind = | false | null | false | {
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll
} | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.Mkparser_kind'",
"FStar.Pervasives.Native.None",
"Prims.nat",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.ParserConsumesAll",
"LowParse.Spec.Base.parser_kind_metadata_some"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind = | false | true | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_all_bytes_kind : LowParse.Spec.Base.parser_kind' | [] | LowParse.Spec.Bytes.parse_all_bytes_kind | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | LowParse.Spec.Base.parser_kind' | {
"end_col": 49,
"end_line": 73,
"start_col": 4,
"start_line": 70
} |
|
Prims.GTot | val parse_bounded_vlbytes_pred
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: B32.bytes)
: GTot Type0 | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max | val parse_bounded_vlbytes_pred
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: B32.bytes)
: GTot Type0
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: B32.bytes)
: GTot Type0 = | false | null | false | let reslen = B32.length x in
min <= reslen /\ reslen <= max | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"sometrivial"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"FStar.Bytes.bytes",
"FStar.UInt.uint_t",
"FStar.Bytes.length"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlbytes_pred
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: B32.bytes)
: GTot Type0 | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes_pred | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | min: Prims.nat -> max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} -> x: FStar.Bytes.bytes
-> Prims.GTot Type0 | {
"end_col": 32,
"end_line": 160,
"start_col": 1,
"start_line": 159
} |
Prims.Tot | val serialize_flbytes (sz: nat{sz < 4294967296}) : Tot (serializer (parse_flbytes sz)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz | val serialize_flbytes (sz: nat{sz < 4294967296}) : Tot (serializer (parse_flbytes sz))
let serialize_flbytes (sz: nat{sz < 4294967296}) : Tot (serializer (parse_flbytes sz)) = | false | null | false | serialize_flbytes_correct sz;
serialize_flbytes' sz | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"LowParse.Spec.Bytes.serialize_flbytes'",
"Prims.unit",
"LowParse.Spec.Bytes.serialize_flbytes_correct",
"LowParse.Spec.Base.serializer",
"LowParse.Spec.Base.total_constant_size_parser_kind",
"FStar.Bytes.lbytes",
"LowParse.Spec.Bytes.parse_flbytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_flbytes (sz: nat{sz < 4294967296}) : Tot (serializer (parse_flbytes sz)) | [] | LowParse.Spec.Bytes.serialize_flbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | sz: Prims.nat{sz < 4294967296}
-> LowParse.Spec.Base.serializer (LowParse.Spec.Bytes.parse_flbytes sz) | {
"end_col": 23,
"end_line": 58,
"start_col": 2,
"start_line": 57
} |
Prims.Tot | val parse_all_bytes' (input: bytes) : Tot (option (B32.bytes * consumed_length input)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end | val parse_all_bytes' (input: bytes) : Tot (option (B32.bytes * consumed_length input))
let parse_all_bytes' (input: bytes) : Tot (option (B32.bytes * consumed_length input)) = | false | null | false | let len = Seq.length input in
if len >= 4294967296
then None
else
(lt_pow2_32 len;
Some (B32.b32_hide input, len)) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"LowParse.Bytes.bytes",
"Prims.op_GreaterThanOrEqual",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"FStar.Bytes.bytes",
"LowParse.Spec.Base.consumed_length",
"Prims.bool",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"LowParse.Bytes32.b32_hide",
"Prims.unit",
"LowParse.Spec.Bytes.lt_pow2_32",
"FStar.Pervasives.Native.option",
"Prims.nat",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_all_bytes' (input: bytes) : Tot (option (B32.bytes * consumed_length input)) | [] | LowParse.Spec.Bytes.parse_all_bytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | input: LowParse.Bytes.bytes
-> FStar.Pervasives.Native.option (FStar.Bytes.bytes * LowParse.Spec.Base.consumed_length input) | {
"end_col": 5,
"end_line": 85,
"start_col": 1,
"start_line": 79
} |
Prims.GTot | val parse_flbytes_gen (sz: nat{sz < 4294967296}) (s: bytes{Seq.length s == sz})
: GTot (B32.lbytes sz) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s | val parse_flbytes_gen (sz: nat{sz < 4294967296}) (s: bytes{Seq.length s == sz})
: GTot (B32.lbytes sz)
let parse_flbytes_gen (sz: nat{sz < 4294967296}) (s: bytes{Seq.length s == sz})
: GTot (B32.lbytes sz) = | false | null | false | lt_pow2_32 sz;
B32.hide s | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"sometrivial"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"LowParse.Bytes.bytes",
"Prims.eq2",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"FStar.Bytes.hide",
"Prims.unit",
"LowParse.Spec.Bytes.lt_pow2_32",
"FStar.Bytes.lbytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_flbytes_gen (sz: nat{sz < 4294967296}) (s: bytes{Seq.length s == sz})
: GTot (B32.lbytes sz) | [] | LowParse.Spec.Bytes.parse_flbytes_gen | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | sz: Prims.nat{sz < 4294967296} -> s: LowParse.Bytes.bytes{FStar.Seq.Base.length s == sz}
-> Prims.GTot (FStar.Bytes.lbytes sz) | {
"end_col": 12,
"end_line": 23,
"start_col": 2,
"start_line": 22
} |
Prims.Tot | val parse_flbytes (sz: nat{sz < 4294967296})
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz) | val parse_flbytes (sz: nat{sz < 4294967296})
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
let parse_flbytes (sz: nat{sz < 4294967296})
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz)) = | false | null | false | make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"LowParse.Spec.Combinators.make_total_constant_size_parser",
"FStar.Bytes.lbytes",
"LowParse.Spec.Bytes.parse_flbytes_gen",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.total_constant_size_parser_kind"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_flbytes (sz: nat{sz < 4294967296})
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz)) | [] | LowParse.Spec.Bytes.parse_flbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | sz: Prims.nat{sz < 4294967296}
-> LowParse.Spec.Base.parser (LowParse.Spec.Base.total_constant_size_parser_kind sz)
(FStar.Bytes.lbytes sz) | {
"end_col": 75,
"end_line": 28,
"start_col": 2,
"start_line": 28
} |
Prims.Tot | val parse_bounded_vlbytes_kind (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot parser_kind | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind | val parse_bounded_vlbytes_kind (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot parser_kind
let parse_bounded_vlbytes_kind (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot parser_kind = | false | null | false | parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.Base.parser_kind"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 }) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlbytes_kind (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot parser_kind | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes_kind | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | min: Prims.nat -> max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296}
-> LowParse.Spec.Base.parser_kind | {
"end_col": 77,
"end_line": 172,
"start_col": 2,
"start_line": 172
} |
FStar.Pervasives.Lemma | val parse_all_bytes_injective: Prims.unit -> Lemma (injective parse_all_bytes') | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x)) | val parse_all_bytes_injective: Prims.unit -> Lemma (injective parse_all_bytes')
let parse_all_bytes_injective () : Lemma (injective parse_all_bytes') = | false | null | true | let prf (b1 b2: bytes)
: Lemma (requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2)) =
assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x)) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.unit",
"FStar.Classical.forall_intro_2",
"LowParse.Bytes.bytes",
"Prims.l_imp",
"LowParse.Spec.Base.injective_precond",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes'",
"LowParse.Spec.Base.injective_postcond",
"FStar.Classical.move_requires",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Bytes.reveal_hide",
"LowParse.Spec.Bytes.lt_pow2_32",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThan",
"LowParse.Spec.Base.injective"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma | false | false | LowParse.Spec.Bytes.fst | {
"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": 16,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_all_bytes_injective: Prims.unit -> Lemma (injective parse_all_bytes') | [] | LowParse.Spec.Bytes.parse_all_bytes_injective | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures LowParse.Spec.Base.injective LowParse.Spec.Bytes.parse_all_bytes') | {
"end_col": 69,
"end_line": 103,
"start_col": 1,
"start_line": 91
} |
FStar.Pervasives.Lemma | val serialize_flbytes_correct (sz: nat{sz < 4294967296})
: Lemma (serializer_correct (parse_flbytes sz) (serialize_flbytes' sz)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf | val serialize_flbytes_correct (sz: nat{sz < 4294967296})
: Lemma (serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
let serialize_flbytes_correct (sz: nat{sz < 4294967296})
: Lemma (serializer_correct (parse_flbytes sz) (serialize_flbytes' sz)) = | false | null | true | let prf (input: B32.lbytes sz)
: Lemma
(let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\ parse (parse_flbytes sz) ser == Some (input, sz)) =
()
in
Classical.forall_intro prf | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Classical.forall_intro",
"FStar.Bytes.lbytes",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"LowParse.Spec.Bytes.serialize_flbytes'",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"LowParse.Spec.Bytes.parse_flbytes",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.serializer_correct",
"LowParse.Spec.Base.total_constant_size_parser_kind"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_flbytes_correct (sz: nat{sz < 4294967296})
: Lemma (serializer_correct (parse_flbytes sz) (serialize_flbytes' sz)) | [] | LowParse.Spec.Bytes.serialize_flbytes_correct | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | sz: Prims.nat{sz < 4294967296}
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Base.serializer_correct (LowParse.Spec.Bytes.parse_flbytes sz)
(LowParse.Spec.Bytes.serialize_flbytes' sz)) | {
"end_col": 28,
"end_line": 52,
"start_col": 1,
"start_line": 42
} |
Prims.Tot | val serialize_all_bytes:serializer parse_all_bytes | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes' | val serialize_all_bytes:serializer parse_all_bytes
let serialize_all_bytes:serializer parse_all_bytes = | false | null | false | serialize_all_bytes_correct ();
serialize_all_bytes' | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"LowParse.Spec.Bytes.serialize_all_bytes'",
"Prims.unit",
"LowParse.Spec.Bytes.serialize_all_bytes_correct"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options | false | true | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_all_bytes:serializer parse_all_bytes | [] | LowParse.Spec.Bytes.serialize_all_bytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | LowParse.Spec.Base.serializer LowParse.Spec.Bytes.parse_all_bytes | {
"end_col": 22,
"end_line": 145,
"start_col": 2,
"start_line": 144
} |
Prims.Tot | val tot_parse_all_bytes:tot_parser parse_all_bytes_kind B32.bytes | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes' | val tot_parse_all_bytes:tot_parser parse_all_bytes_kind B32.bytes
let tot_parse_all_bytes:tot_parser parse_all_bytes_kind B32.bytes = | false | null | false | parse_all_bytes_correct ();
parse_all_bytes' | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"LowParse.Spec.Bytes.parse_all_bytes'",
"Prims.unit",
"LowParse.Spec.Bytes.parse_all_bytes_correct"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective () | false | true | LowParse.Spec.Bytes.fst | {
"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"
} | null | val tot_parse_all_bytes:tot_parser parse_all_bytes_kind B32.bytes | [] | LowParse.Spec.Bytes.tot_parse_all_bytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | LowParse.Spec.Base.tot_parser LowParse.Spec.Bytes.parse_all_bytes_kind FStar.Bytes.bytes | {
"end_col": 18,
"end_line": 114,
"start_col": 2,
"start_line": 113
} |
FStar.Pervasives.Lemma | val parse_all_bytes_correct: Prims.unit
-> Lemma (parser_kind_prop parse_all_bytes_kind parse_all_bytes') | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective () | val parse_all_bytes_correct: Prims.unit
-> Lemma (parser_kind_prop parse_all_bytes_kind parse_all_bytes')
let parse_all_bytes_correct () : Lemma (parser_kind_prop parse_all_bytes_kind parse_all_bytes') = | false | null | true | parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective () | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.unit",
"LowParse.Spec.Bytes.parse_all_bytes_injective",
"LowParse.Spec.Base.parser_kind_prop_equiv",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.Bytes.parse_all_bytes'",
"Prims.l_True",
"Prims.squash",
"LowParse.Spec.Base.parser_kind_prop",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_all_bytes_correct: Prims.unit
-> Lemma (parser_kind_prop parse_all_bytes_kind parse_all_bytes') | [] | LowParse.Spec.Bytes.parse_all_bytes_correct | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Base.parser_kind_prop LowParse.Spec.Bytes.parse_all_bytes_kind
LowParse.Spec.Bytes.parse_all_bytes') | {
"end_col": 30,
"end_line": 110,
"start_col": 2,
"start_line": 109
} |
Prims.Tot | val parse_all_bytes:parser parse_all_bytes_kind B32.bytes | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes | val parse_all_bytes:parser parse_all_bytes_kind B32.bytes
let parse_all_bytes:parser parse_all_bytes_kind B32.bytes = | false | null | false | tot_parse_all_bytes | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"LowParse.Spec.Bytes.tot_parse_all_bytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes' | false | true | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_all_bytes:parser parse_all_bytes_kind B32.bytes | [] | LowParse.Spec.Bytes.parse_all_bytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | LowParse.Spec.Base.parser LowParse.Spec.Bytes.parse_all_bytes_kind FStar.Bytes.bytes | {
"end_col": 21,
"end_line": 117,
"start_col": 2,
"start_line": 117
} |
Prims.Tot | val synth_bounded_vlbytes_recip
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x | val synth_bounded_vlbytes_recip
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes) = | false | null | false | x | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val synth_bounded_vlbytes_recip
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes) | [] | LowParse.Spec.Bytes.synth_bounded_vlbytes_recip | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
x: LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max
-> LowParse.Spec.VLData.parse_bounded_vldata_strong_t min
max
LowParse.Spec.Bytes.serialize_all_bytes | {
"end_col": 3,
"end_line": 234,
"start_col": 2,
"start_line": 234
} |
Prims.Tot | val parse_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot
(parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max) | val parse_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot
(parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max))
let parse_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot
(parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) = | false | null | false | parse_bounded_vlbytes' min max (log256' max) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Bytes.parse_bounded_vlbytes'",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Base.parser",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot
(parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | min: Prims.nat -> max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296}
-> LowParse.Spec.Base.parser (LowParse.Spec.VLData.parse_bounded_vldata_strong_kind min
max
(LowParse.Spec.BoundedInt.log256' max)
LowParse.Spec.Bytes.parse_all_bytes_kind)
(LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max) | {
"end_col": 46,
"end_line": 193,
"start_col": 2,
"start_line": 193
} |
Prims.Tot | val parse_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot
(parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot (parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlgen min max pk serialize_all_bytes `parse_synth` synth_bounded_vlbytes min max | val parse_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot
(parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max))
let parse_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot
(parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) = | false | null | false | (parse_bounded_vlgen min max pk serialize_all_bytes) `parse_synth` (synth_bounded_vlbytes min max) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.Combinators.parse_synth",
"LowParse.Spec.VLGen.parse_bounded_vlgen_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.VLGen.parse_bounded_vlgen",
"LowParse.Spec.Bytes.synth_bounded_vlbytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
= serialize_synth_eq
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x
let length_serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x)
= length_serialize_bounded_vlbytes' min max (log256' max) x
let parse_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max)) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot
(parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [] | LowParse.Spec.Bytes.parse_bounded_vlgenbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max)
-> LowParse.Spec.Base.parser (LowParse.Spec.VLGen.parse_bounded_vlgen_kind sk
min
max
LowParse.Spec.Bytes.parse_all_bytes_kind)
(LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max) | {
"end_col": 96,
"end_line": 283,
"start_col": 2,
"start_line": 283
} |
Prims.Tot | val serialize_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot (serializer (parse_bounded_vlbytes min max)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max) | val serialize_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot (serializer (parse_bounded_vlbytes min max))
let serialize_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot (serializer (parse_bounded_vlbytes min max)) = | false | null | false | serialize_bounded_vlbytes' min max (log256' max) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Bytes.serialize_bounded_vlbytes'",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Base.serializer",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Bytes.parse_bounded_vlbytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_bounded_vlbytes (min: nat) (max: nat{min <= max /\ max > 0 /\ max < 4294967296})
: Tot (serializer (parse_bounded_vlbytes min max)) | [] | LowParse.Spec.Bytes.serialize_bounded_vlbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | min: Prims.nat -> max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296}
-> LowParse.Spec.Base.serializer (LowParse.Spec.Bytes.parse_bounded_vlbytes min max) | {
"end_col": 50,
"end_line": 252,
"start_col": 2,
"start_line": 252
} |
Prims.Tot | val serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_bounded_vlgenbytes min max pk)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk { kk.parser_kind_subkind == Some ParserStrong })
: Tot (serializer (parse_bounded_vlgenbytes min max pk))
= serialize_synth
(parse_bounded_vlgen min max pk serialize_all_bytes)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlgen min max sk serialize_all_bytes)
(synth_bounded_vlbytes_recip min max)
() | val serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_bounded_vlgenbytes min max pk))
let serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_bounded_vlgenbytes min max pk)) = | false | null | false | serialize_synth (parse_bounded_vlgen min max pk serialize_all_bytes)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlgen min max sk serialize_all_bytes)
(synth_bounded_vlbytes_recip min max)
() | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.Base.serializer",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Combinators.serialize_synth",
"LowParse.Spec.VLGen.parse_bounded_vlgen_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.VLGen.parse_bounded_vlgen",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"LowParse.Spec.VLGen.serialize_bounded_vlgen",
"LowParse.Spec.Bytes.synth_bounded_vlbytes_recip",
"LowParse.Spec.Bytes.parse_bounded_vlgenbytes"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
= serialize_synth_eq
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x
let length_serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x)
= length_serialize_bounded_vlbytes' min max (log256' max) x
let parse_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot (parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlgen min max pk serialize_all_bytes `parse_synth` synth_bounded_vlbytes min max
let serialize_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk { kk.parser_kind_subkind == Some ParserStrong }) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_bounded_vlgenbytes min max pk)) | [] | LowParse.Spec.Bytes.serialize_bounded_vlgenbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
sk:
LowParse.Spec.Base.serializer pk
{ Mkparser_kind'?.parser_kind_subkind kk ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong }
-> LowParse.Spec.Base.serializer (LowParse.Spec.Bytes.parse_bounded_vlgenbytes min max pk) | {
"end_col": 6,
"end_line": 297,
"start_col": 2,
"start_line": 292
} |
FStar.Pervasives.Lemma | val length_serialize_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let length_serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x)
= length_serialize_bounded_vlbytes' min max (log256' max) x | val length_serialize_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x)
let length_serialize_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x) = | false | null | true | length_serialize_bounded_vlbytes' min max (log256' max) x | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Bytes.length_serialize_bounded_vlbytes'",
"LowParse.Spec.BoundedInt.log256'",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.Bytes.parse_bounded_vlbytes",
"LowParse.Spec.Bytes.serialize_bounded_vlbytes",
"Prims.op_Addition",
"FStar.Bytes.length",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
= serialize_synth_eq
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x
let length_serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val length_serialize_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x) | [] | LowParse.Spec.Bytes.length_serialize_bounded_vlbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
x: LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.length (LowParse.Spec.Base.serialize (LowParse.Spec.Bytes.serialize_bounded_vlbytes
min
max)
x) ==
LowParse.Spec.BoundedInt.log256' max + FStar.Bytes.length x) | {
"end_col": 59,
"end_line": 275,
"start_col": 2,
"start_line": 275
} |
FStar.Pervasives.Lemma | val serialize_all_bytes_correct: Prims.unit
-> Lemma (serializer_correct parse_all_bytes serialize_all_bytes') | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf | val serialize_all_bytes_correct: Prims.unit
-> Lemma (serializer_correct parse_all_bytes serialize_all_bytes')
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') = | false | null | true | let prf (input: B32.bytes)
: Lemma
(let ser = serialize_all_bytes' input in
let len:consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)) =
assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.unit",
"FStar.Classical.forall_intro",
"FStar.Bytes.bytes",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Bytes.serialize_all_bytes'",
"LowParse.Spec.Base.parse",
"LowParse.Spec.Bytes.parse_all_bytes",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Bytes.hide_reveal",
"LowParse.Spec.Bytes.lt_pow2_32",
"FStar.Bytes.length",
"Prims._assert",
"Prims.int",
"Prims.l_or",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt.size",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.serializer_correct",
"LowParse.Spec.Bytes.parse_all_bytes_kind"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32" | false | false | LowParse.Spec.Bytes.fst | {
"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": 32,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val serialize_all_bytes_correct: Prims.unit
-> Lemma (serializer_correct parse_all_bytes serialize_all_bytes') | [] | LowParse.Spec.Bytes.serialize_all_bytes_correct | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Base.serializer_correct LowParse.Spec.Bytes.parse_all_bytes
LowParse.Spec.Bytes.serialize_all_bytes') | {
"end_col": 28,
"end_line": 139,
"start_col": 102,
"start_line": 126
} |
FStar.Pervasives.Lemma | val length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk { kk.parser_kind_subkind == Some ParserStrong })
(x: parse_bounded_vlbytes_t min max)
: Lemma
(
Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x
)
= serialize_synth_eq
(parse_bounded_vlgen min max pk serialize_all_bytes)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlgen min max sk serialize_all_bytes)
(synth_bounded_vlbytes_recip min max)
()
x;
serialize_bounded_vlgen_unfold
min
max
sk
serialize_all_bytes
x | val length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x)
let length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x) = | false | null | true | serialize_synth_eq (parse_bounded_vlgen min max pk serialize_all_bytes)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlgen min max sk serialize_all_bytes)
(synth_bounded_vlbytes_recip min max)
()
x;
serialize_bounded_vlgen_unfold min max sk serialize_all_bytes x | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.Base.serializer",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.VLGen.serialize_bounded_vlgen_unfold",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"Prims.unit",
"LowParse.Spec.Combinators.serialize_synth_eq",
"LowParse.Spec.VLGen.parse_bounded_vlgen_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"LowParse.Spec.VLGen.parse_bounded_vlgen",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"LowParse.Spec.VLGen.serialize_bounded_vlgen",
"LowParse.Spec.Bytes.synth_bounded_vlbytes_recip",
"Prims.l_True",
"Prims.squash",
"Prims.int",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.Bytes.parse_bounded_vlgenbytes",
"LowParse.Spec.Bytes.serialize_bounded_vlgenbytes",
"Prims.op_Addition",
"FStar.Bytes.len",
"FStar.Bytes.length",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
= serialize_synth_eq
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x
let length_serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes min max) x) == log256' max + B32.length x)
= length_serialize_bounded_vlbytes' min max (log256' max) x
let parse_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#sk: parser_kind)
(pk: parser sk (bounded_int32 min max))
: Tot (parser (parse_bounded_vlgen_kind sk min max parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlgen min max pk serialize_all_bytes `parse_synth` synth_bounded_vlbytes min max
let serialize_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk { kk.parser_kind_subkind == Some ParserStrong })
: Tot (serializer (parse_bounded_vlgenbytes min max pk))
= serialize_synth
(parse_bounded_vlgen min max pk serialize_all_bytes)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlgen min max sk serialize_all_bytes)
(synth_bounded_vlbytes_recip min max)
()
let length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk { kk.parser_kind_subkind == Some ParserStrong })
(x: parse_bounded_vlbytes_t min max)
: Lemma
(
Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val length_serialize_bounded_vlgenbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(#kk: parser_kind)
(#pk: parser kk (bounded_int32 min max))
(sk: serializer pk {kk.parser_kind_subkind == Some ParserStrong})
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlgenbytes min max sk) x) ==
Seq.length (serialize sk (B32.len x)) + B32.length x) | [] | LowParse.Spec.Bytes.length_serialize_bounded_vlgenbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
sk:
LowParse.Spec.Base.serializer pk
{ Mkparser_kind'?.parser_kind_subkind kk ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } ->
x: LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.length (LowParse.Spec.Base.serialize (LowParse.Spec.Bytes.serialize_bounded_vlgenbytes
min
max
sk)
x) ==
FStar.Seq.Base.length (LowParse.Spec.Base.serialize sk (FStar.Bytes.len x)) +
FStar.Bytes.length x) | {
"end_col": 5,
"end_line": 323,
"start_col": 2,
"start_line": 311
} |
Prims.Tot | val parse_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) | val parse_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max))
let parse_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) = | false | null | false | parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Combinators.parse_synth",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"LowParse.Spec.Base.parser"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vlbytes_t min max)) | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4}
-> LowParse.Spec.Base.parser (LowParse.Spec.VLData.parse_bounded_vldata_strong_kind min
max
l
LowParse.Spec.Bytes.parse_all_bytes_kind)
(LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max) | {
"end_col": 83,
"end_line": 187,
"start_col": 2,
"start_line": 187
} |
Prims.Tot | val parse_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes | val parse_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)) = | false | null | false | parse_bounded_vldata_strong' min max l serialize_all_bytes | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.VLData.parse_bounded_vldata_strong'",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Base.parser",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val parse_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot
(parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind)
(parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)) | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes_aux | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4}
-> LowParse.Spec.Base.parser (LowParse.Spec.VLData.parse_bounded_vldata_strong_kind min
max
l
LowParse.Spec.Bytes.parse_all_bytes_kind)
(LowParse.Spec.VLData.parse_bounded_vldata_strong_t min
max
LowParse.Spec.Bytes.serialize_all_bytes) | {
"end_col": 60,
"end_line": 152,
"start_col": 2,
"start_line": 152
} |
Prims.Tot | val synth_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x | val synth_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
let synth_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max) = | false | null | false | x | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val synth_bounded_vlbytes
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max) | [] | LowParse.Spec.Bytes.synth_bounded_vlbytes | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
x:
LowParse.Spec.VLData.parse_bounded_vldata_strong_t min
max
LowParse.Spec.Bytes.serialize_all_bytes
-> LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max | {
"end_col": 3,
"end_line": 180,
"start_col": 2,
"start_line": 180
} |
Prims.Tot | val serialize_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes_aux min max l)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes | val serialize_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes_aux min max l)) = | false | null | false | serialize_bounded_vldata_strong' min max l serialize_all_bytes | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.VLData.serialize_bounded_vldata_strong'",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Base.serializer",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_aux"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_bounded_vlbytes_aux
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes_aux min max l)) | [] | LowParse.Spec.Bytes.serialize_bounded_vlbytes_aux | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4}
-> LowParse.Spec.Base.serializer (LowParse.Spec.Bytes.parse_bounded_vlbytes_aux min max l) | {
"end_col": 64,
"end_line": 226,
"start_col": 2,
"start_line": 226
} |
Prims.Tot | val serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes' min max l)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
() | val serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes' min max l))
let serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes' min max l)) = | false | null | false | serialize_synth (parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
() | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Combinators.serialize_synth",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"LowParse.Spec.Bytes.serialize_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes_recip",
"LowParse.Spec.Base.serializer",
"LowParse.Spec.Bytes.parse_bounded_vlbytes'"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } ) | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
: Tot (serializer (parse_bounded_vlbytes' min max l)) | [] | LowParse.Spec.Bytes.serialize_bounded_vlbytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4}
-> LowParse.Spec.Base.serializer (LowParse.Spec.Bytes.parse_bounded_vlbytes' min max l) | {
"end_col": 6,
"end_line": 246,
"start_col": 2,
"start_line": 241
} |
FStar.Pervasives.Lemma | val length_serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(x: parse_bounded_vlbytes_t min max)
: Lemma (Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma
(Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
= serialize_synth_eq
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x | val length_serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(x: parse_bounded_vlbytes_t min max)
: Lemma (Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(x: parse_bounded_vlbytes_t min max)
: Lemma (Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x) = | false | null | true | serialize_synth_eq (parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
x | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Combinators.serialize_synth_eq",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"LowParse.Spec.Bytes.serialize_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes_recip",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.Bytes.parse_bounded_vlbytes'",
"LowParse.Spec.Bytes.serialize_bounded_vlbytes'",
"Prims.op_Addition",
"FStar.Bytes.length",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz)
#reset-options
let serialize_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes_aux min max l))
= serialize_bounded_vldata_strong' min max l serialize_all_bytes
inline_for_extraction
let synth_bounded_vlbytes_recip
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vlbytes_t min max)
: Tot (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
= x
let serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (serializer (parse_bounded_vlbytes' min max l))
= serialize_synth
(parse_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes min max)
(serialize_bounded_vlbytes_aux min max l)
(synth_bounded_vlbytes_recip min max)
()
let serialize_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (serializer (parse_bounded_vlbytes min max))
= serialize_bounded_vlbytes' min max (log256' max)
let length_serialize_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(x: parse_bounded_vlbytes_t min max)
: Lemma | false | false | LowParse.Spec.Bytes.fst | {
"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"
} | null | val length_serialize_bounded_vlbytes'
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(x: parse_bounded_vlbytes_t min max)
: Lemma (Seq.length (serialize (serialize_bounded_vlbytes' min max l) x) == l + B32.length x) | [] | LowParse.Spec.Bytes.length_serialize_bounded_vlbytes' | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4} ->
x: LowParse.Spec.Bytes.parse_bounded_vlbytes_t min max
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.length (LowParse.Spec.Base.serialize (LowParse.Spec.Bytes.serialize_bounded_vlbytes'
min
max
l)
x) ==
l + FStar.Bytes.length x) | {
"end_col": 5,
"end_line": 267,
"start_col": 2,
"start_line": 261
} |
FStar.Pervasives.Lemma | val parse_bounded_vlbytes_eq
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res ==
Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else res == None) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.VLGen",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None
)
= let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz) | val parse_bounded_vlbytes_eq
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res ==
Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else res == None)
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res ==
Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else res == None) = | false | null | true | let sz = l in
parse_synth_eq (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max) input;
parse_vldata_gen_eq sz (in_bounds min max) parse_all_bytes input;
parser_kind_prop_equiv (parse_bounded_integer_kind sz) (parse_bounded_integer sz) | {
"checked_file": "LowParse.Spec.Bytes.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.VLGen.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.Bytes.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.parser_kind_prop_equiv",
"LowParse.Spec.BoundedInt.bounded_integer",
"LowParse.Spec.BoundedInt.parse_bounded_integer_kind",
"LowParse.Spec.BoundedInt.parse_bounded_integer",
"Prims.unit",
"LowParse.Spec.VLData.parse_vldata_gen_eq",
"LowParse.Spec.BoundedInt.in_bounds",
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"FStar.Bytes.bytes",
"LowParse.Spec.Bytes.parse_all_bytes",
"LowParse.Spec.Combinators.parse_synth_eq",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_kind",
"LowParse.Spec.VLData.parse_bounded_vldata_strong_t",
"LowParse.Spec.Bytes.serialize_all_bytes",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_t",
"LowParse.Spec.Bytes.parse_bounded_vlbytes_aux",
"LowParse.Spec.Bytes.synth_bounded_vlbytes",
"Prims.l_True",
"Prims.squash",
"LowParse.Spec.Base.parse",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"FStar.Pervasives.Native.None",
"Prims.op_AmpAmp",
"FStar.UInt32.v",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"Prims.l_or",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Bytes.hide",
"FStar.Seq.Base.slice",
"Prims.bool",
"LowParse.Spec.Bytes.parse_bounded_vlbytes'",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.Spec.Bytes
include LowParse.Spec.VLGen
module B32 = LowParse.Bytes32
module Seq = FStar.Seq
module U32 = FStar.UInt32
#set-options "--z3rlimit 128 --max_fuel 64 --max_ifuel 64"
let lt_pow2_32
(x: nat)
: Lemma
(x < 4294967296 <==> x < pow2 32)
= ()
#reset-options
let parse_flbytes_gen
(sz: nat { sz < 4294967296 } )
(s: bytes { Seq.length s == sz } )
: GTot (B32.lbytes sz)
= lt_pow2_32 sz;
B32.hide s
let parse_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (parser (total_constant_size_parser_kind sz) (B32.lbytes sz))
= make_total_constant_size_parser sz (B32.lbytes sz) (parse_flbytes_gen sz)
let serialize_flbytes'
(sz: nat { sz < 4294967296 } )
: Tot (bare_serializer (B32.lbytes sz))
= fun (x: B32.lbytes sz) -> (
lt_pow2_32 sz;
B32.reveal x
)
let serialize_flbytes_correct
(sz: nat { sz < 4294967296 } )
: Lemma
(serializer_correct (parse_flbytes sz) (serialize_flbytes' sz))
= let prf
(input: B32.lbytes sz)
: Lemma
(
let ser = serialize_flbytes' sz input in
Seq.length ser == sz /\
parse (parse_flbytes sz) ser == Some (input, sz)
)
= ()
in
Classical.forall_intro prf
let serialize_flbytes
(sz: nat { sz < 4294967296 } )
: Tot (serializer (parse_flbytes sz))
= serialize_flbytes_correct sz;
serialize_flbytes' sz
(* VLBytes *)
(* For the payload: since the input buffer is truncated at the time of
reading the length header, "parsing" the payload will always succeed,
by just returning it unchanged (unless the length of the input
is greater than 2^32) *)
inline_for_extraction
let parse_all_bytes_kind =
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_metadata = None;
parser_kind_subkind = Some ParserConsumesAll;
}
let parse_all_bytes'
(input: bytes)
: Tot (option (B32.bytes * consumed_length input))
= let len = Seq.length input in
if len >= 4294967296
then None
else begin
lt_pow2_32 len;
Some (B32.b32_hide input, len)
end
#set-options "--z3rlimit 16"
let parse_all_bytes_injective () : Lemma
(injective parse_all_bytes')
= let prf
(b1 b2: bytes)
: Lemma
(requires (injective_precond parse_all_bytes' b1 b2))
(ensures (injective_postcond parse_all_bytes' b1 b2))
= assert (Seq.length b1 < 4294967296);
assert (Seq.length b2 < 4294967296);
lt_pow2_32 (Seq.length b1);
lt_pow2_32 (Seq.length b2);
B32.reveal_hide b1;
B32.reveal_hide b2
in
Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))
#reset-options
let parse_all_bytes_correct () : Lemma
(parser_kind_prop parse_all_bytes_kind parse_all_bytes')
= parser_kind_prop_equiv parse_all_bytes_kind parse_all_bytes';
parse_all_bytes_injective ()
let tot_parse_all_bytes : tot_parser parse_all_bytes_kind B32.bytes =
parse_all_bytes_correct ();
parse_all_bytes'
let parse_all_bytes : parser parse_all_bytes_kind B32.bytes =
tot_parse_all_bytes
let serialize_all_bytes'
(input: B32.bytes)
: GTot bytes
= B32.reveal input
#set-options "--z3rlimit 32"
let serialize_all_bytes_correct () : Lemma (serializer_correct parse_all_bytes serialize_all_bytes') =
let prf
(input: B32.bytes)
: Lemma
(
let ser = serialize_all_bytes' input in
let len : consumed_length ser = Seq.length ser in
parse parse_all_bytes ser == Some (input, len)
)
= assert (Seq.length (serialize_all_bytes' input) == B32.length input);
lt_pow2_32 (B32.length input);
B32.hide_reveal input
in
Classical.forall_intro prf
#reset-options
let serialize_all_bytes : serializer parse_all_bytes =
serialize_all_bytes_correct ();
serialize_all_bytes'
let parse_bounded_vlbytes_aux
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes))
= parse_bounded_vldata_strong' min max l serialize_all_bytes
let parse_bounded_vlbytes_pred
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(x: B32.bytes)
: GTot Type0
= let reslen = B32.length x in
min <= reslen /\ reslen <= max
let parse_bounded_vlbytes_t
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot Type
= (x: B32.bytes { parse_bounded_vlbytes_pred min max x } )
let parse_bounded_vlbytes_kind
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
: Tot parser_kind
= parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind
inline_for_extraction
let synth_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 })
(x: parse_bounded_vldata_strong_t min max #_ #_ #parse_all_bytes serialize_all_bytes)
: Tot (parse_bounded_vlbytes_t min max)
= x
let parse_bounded_vlbytes'
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max l parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_synth (parse_bounded_vlbytes_aux min max l) (synth_bounded_vlbytes min max)
let parse_bounded_vlbytes
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
: Tot (parser (parse_bounded_vldata_strong_kind min max (log256' max) parse_all_bytes_kind) (parse_bounded_vlbytes_t min max))
= parse_bounded_vlbytes' min max (log256' max)
#set-options "--z3rlimit 16"
let parse_bounded_vlbytes_eq
(min: nat)
(max: nat { min <= max /\ max > 0 /\ max < 4294967296 } )
(l: nat { l >= log256' max /\ l <= 4 } )
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res == Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else
res == None | false | false | LowParse.Spec.Bytes.fst | {
"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": 16,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_bounded_vlbytes_eq
(min: nat)
(max: nat{min <= max /\ max > 0 /\ max < 4294967296})
(l: nat{l >= log256' max /\ l <= 4})
(input: bytes)
: Lemma
(let res = parse (parse_bounded_vlbytes' min max l) input in
match parse (parse_bounded_integer l) input with
| None -> res == None
| Some (header, consumed_header) ->
if min <= U32.v header && U32.v header <= max && l + U32.v header <= Seq.length input
then
consumed_header == l /\
res ==
Some (B32.hide (Seq.slice input l (l + U32.v header)), consumed_header + U32.v header)
else res == None) | [] | LowParse.Spec.Bytes.parse_bounded_vlbytes_eq | {
"file_name": "src/lowparse/LowParse.Spec.Bytes.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: Prims.nat ->
max: Prims.nat{min <= max /\ max > 0 /\ max < 4294967296} ->
l: Prims.nat{l >= LowParse.Spec.BoundedInt.log256' max /\ l <= 4} ->
input: LowParse.Bytes.bytes
-> FStar.Pervasives.Lemma
(ensures
(let res =
LowParse.Spec.Base.parse (LowParse.Spec.Bytes.parse_bounded_vlbytes' min max l) input
in
(match
LowParse.Spec.Base.parse (LowParse.Spec.BoundedInt.parse_bounded_integer l) input
with
| FStar.Pervasives.Native.None #_ -> res == FStar.Pervasives.Native.None
| FStar.Pervasives.Native.Some
#_
(FStar.Pervasives.Native.Mktuple2 #_ #_ header consumed_header) ->
(match
min <= FStar.UInt32.v header && FStar.UInt32.v header <= max &&
l + FStar.UInt32.v header <= FStar.Seq.Base.length input
with
| true ->
consumed_header == l /\
res ==
FStar.Pervasives.Native.Some
(FStar.Bytes.hide (FStar.Seq.Base.slice input l (l + FStar.UInt32.v header)),
consumed_header + FStar.UInt32.v header)
| _ -> res == FStar.Pervasives.Native.None)
<:
Type0)
<:
Type0)) | {
"end_col": 83,
"end_line": 217,
"start_col": 1,
"start_line": 214
} |
Prims.Tot | val decode_templong_t : i:size_nat{i <= 8} -> Type0 | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let decode_templong_t i = uint64 | val decode_templong_t : i:size_nat{i <= 8} -> Type0
let decode_templong_t i = | false | null | false | uint64 | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.uint64"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res
val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64
let frodo_key_decode0 logq b n a i k templong =
templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k)
val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode1 logq b n i templong res =
update_sub res (i * b) b (LSeq.sub (uint_to_bytes_le templong) 0 b) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val decode_templong_t : i:size_nat{i <= 8} -> Type0 | [] | Spec.Frodo.Encode.decode_templong_t | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | i: Lib.IntTypes.size_nat{i <= 8} -> Type0 | {
"end_col": 32,
"end_line": 194,
"start_col": 26,
"start_line": 194
} |
Prims.Pure | val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b)) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res | val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k = | false | null | false | let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc ( < ) {
v k * pow2 (logq - b);
( < ) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
( == ) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.uint16",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U16",
"Lib.IntTypes.SEC",
"Prims.pow2",
"Prims.unit",
"Prims._assert",
"Prims.op_Equality",
"Prims.int",
"FStar.Mul.op_Star",
"Prims.op_Subtraction",
"FStar.Math.Lemmas.small_modulo_lemma_2",
"Lib.IntTypes.modulus",
"FStar.Math.Lemmas.pow2_le_compat",
"FStar.Calc.calc_finish",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.eq2",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.lemma_mult_lt_right",
"Prims.squash",
"FStar.Math.Lemmas.pow2_plus",
"Prims.op_Modulus",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Less_Less_Dot",
"Lib.IntTypes.size"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b)) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b)) | [] | Spec.Frodo.Encode.ec | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq} ->
k: Lib.IntTypes.uint16{Lib.IntTypes.v k < Prims.pow2 b}
-> Prims.Pure Lib.IntTypes.uint16 | {
"end_col": 5,
"end_line": 43,
"start_col": 17,
"start_line": 28
} |
Prims.Tot | val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k | val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res = | false | null | false | res.(i, k) <- ec1 logq b x k | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Lib.IntTypes.uint64",
"Lib.IntTypes.size_nat",
"Prims.op_LessThan",
"Spec.Matrix.matrix",
"Spec.Matrix.op_Array_Assignment",
"FStar.Pervasives.Native.Mktuple2",
"Spec.Frodo.Encode.ec1"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n | [] | Spec.Frodo.Encode.frodo_key_encode0 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Lib.ByteSequence.lbytes ((n * n) * b / 8) ->
x: Lib.IntTypes.uint64 ->
i: Lib.IntTypes.size_nat{i < n} ->
k: Lib.IntTypes.size_nat{k < 8} ->
res: Spec.Matrix.matrix n n
-> Spec.Matrix.matrix n n | {
"end_col": 30,
"end_line": 123,
"start_col": 2,
"start_line": 123
} |
Prims.Tot | val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res | val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a = | false | null | false | let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Lib.LoopCombinators.repeati",
"Spec.Matrix.matrix",
"Spec.Frodo.Encode.frodo_key_encode2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U16",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Spec.Matrix.create"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n | [] | Spec.Frodo.Encode.frodo_key_encode | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Lib.ByteSequence.lbytes ((n * n) * b / 8)
-> Spec.Matrix.matrix n n | {
"end_col": 52,
"end_line": 163,
"start_col": 33,
"start_line": 161
} |
Prims.Tot | val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res | val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res = | false | null | false | let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Lib.IntTypes.size_nat",
"Prims.op_LessThan",
"Spec.Matrix.matrix",
"Lib.LoopCombinators.repeati",
"Spec.Frodo.Encode.frodo_key_encode0",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Spec.Frodo.Encode.frodo_key_encode1"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n | [] | Spec.Frodo.Encode.frodo_key_encode2 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Lib.ByteSequence.lbytes ((n * n) * b / 8) ->
i: Lib.IntTypes.size_nat{i < n} ->
res: Spec.Matrix.matrix n n
-> Spec.Matrix.matrix n n | {
"end_col": 56,
"end_line": 151,
"start_col": 40,
"start_line": 149
} |
Prims.Tot | val frodo_key_decode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_decode2 logq b n a i res =
let templong = Loops.repeat_gen 8 decode_templong_t (frodo_key_decode0 logq b n a i) (u64 0) in
frodo_key_decode1 logq b n i templong res | val frodo_key_decode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode2 logq b n a i res = | false | null | false | let templong = Loops.repeat_gen 8 decode_templong_t (frodo_key_decode0 logq b n a i) (u64 0) in
frodo_key_decode1 logq b n i templong res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Spec.Matrix.matrix",
"Lib.IntTypes.size_nat",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Spec.Frodo.Encode.frodo_key_decode1",
"Spec.Frodo.Encode.decode_templong_t",
"Lib.LoopCombinators.repeat_gen",
"Spec.Frodo.Encode.frodo_key_decode0",
"Lib.IntTypes.u64"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res
val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64
let frodo_key_decode0 logq b n a i k templong =
templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k)
val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode1 logq b n i templong res =
update_sub res (i * b) b (LSeq.sub (uint_to_bytes_le templong) 0 b)
val decode_templong_t : i:size_nat{i <= 8} -> Type0
let decode_templong_t i = uint64
val frodo_key_decode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_decode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | [] | Spec.Frodo.Encode.frodo_key_decode2 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b < logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Spec.Matrix.matrix n n ->
i: Lib.IntTypes.size_nat{i < n} ->
res: Lib.ByteSequence.lbytes ((n * n) * b / 8)
-> Lib.ByteSequence.lbytes ((n * n) * b / 8) | {
"end_col": 43,
"end_line": 207,
"start_col": 40,
"start_line": 205
} |
Prims.Tot | val frodo_key_decode:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> lbytes (n * n * b / 8) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_decode logq b n a =
let resLen = n * n * b / 8 in
let res = LSeq.create resLen (u8 0) in
Loops.repeati n (frodo_key_decode2 logq b n a) res | val frodo_key_decode:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> lbytes (n * n * b / 8)
let frodo_key_decode logq b n a = | false | null | false | let resLen = (n * n) * b / 8 in
let res = LSeq.create resLen (u8 0) in
Loops.repeati n (frodo_key_decode2 logq b n a) res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Spec.Matrix.matrix",
"Lib.LoopCombinators.repeati",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Spec.Frodo.Encode.frodo_key_decode2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.create",
"Lib.IntTypes.mk_int",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Lib.Sequence.index",
"Lib.Sequence.create",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.u8"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res
val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64
let frodo_key_decode0 logq b n a i k templong =
templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k)
val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode1 logq b n i templong res =
update_sub res (i * b) b (LSeq.sub (uint_to_bytes_le templong) 0 b)
val decode_templong_t : i:size_nat{i <= 8} -> Type0
let decode_templong_t i = uint64
val frodo_key_decode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode2 logq b n a i res =
let templong = Loops.repeat_gen 8 decode_templong_t (frodo_key_decode0 logq b n a i) (u64 0) in
frodo_key_decode1 logq b n i templong res
val frodo_key_decode:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> lbytes (n * n * b / 8) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_decode:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> lbytes (n * n * b / 8) | [] | Spec.Frodo.Encode.frodo_key_decode | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b < logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Spec.Matrix.matrix n n
-> Lib.ByteSequence.lbytes ((n * n) * b / 8) | {
"end_col": 52,
"end_line": 220,
"start_col": 33,
"start_line": 217
} |
Prims.Pure | val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk)) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk) | val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k = | false | null | false | let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc ( == ) {
v rk;
( == ) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
( == ) { () }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk) | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Lib.IntTypes.uint64",
"Lib.IntTypes.size_nat",
"Prims.op_LessThan",
"Spec.Frodo.Encode.ec",
"Lib.IntTypes.to_u16",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Calc.calc_finish",
"Lib.IntTypes.range_t",
"Prims.eq2",
"Lib.IntTypes.v",
"Prims.op_Modulus",
"Prims.op_Division",
"Prims.pow2",
"FStar.Mul.op_Star",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"Lib.IntTypes.op_Greater_Greater_Dot",
"Lib.IntTypes.size",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Spec.Frodo.Lemmas.modulo_pow2_u64",
"Prims.squash",
"FStar.Math.Lemmas.pow2_lt_compat",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Amp_Dot",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.op_Less_Less_Dot",
"Lib.IntTypes.u64",
"Lib.IntTypes.uint16"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk)) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk)) | [] | Spec.Frodo.Encode.ec1 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq /\ b <= 8} ->
x: Lib.IntTypes.uint64 ->
k: Lib.IntTypes.size_nat{k < 8}
-> Prims.Pure Lib.IntTypes.uint16 | {
"end_col": 23,
"end_line": 108,
"start_col": 20,
"start_line": 96
} |
Prims.Tot | val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_decode1 logq b n i templong res =
update_sub res (i * b) b (LSeq.sub (uint_to_bytes_le templong) 0 b) | val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8)
let frodo_key_decode1 logq b n i templong res = | false | null | false | update_sub res (i * b) b (LSeq.sub (uint_to_bytes_le templong) 0 b) | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Lib.IntTypes.size_nat",
"Lib.IntTypes.uint64",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Lib.Sequence.update_sub",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Sequence.sub",
"Lib.IntTypes.numbytes",
"Lib.IntTypes.U64",
"Lib.ByteSequence.uint_to_bytes_le"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res
val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64
let frodo_key_decode0 logq b n a i k templong =
templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k)
val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_decode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> i:size_nat{i < n}
-> templong:uint64
-> res:lbytes (n * n * b / 8)
-> lbytes (n * n * b / 8) | [] | Spec.Frodo.Encode.frodo_key_decode1 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b < logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
i: Lib.IntTypes.size_nat{i < n} ->
templong: Lib.IntTypes.uint64 ->
res: Lib.ByteSequence.lbytes ((n * n) * b / 8)
-> Lib.ByteSequence.lbytes ((n * n) * b / 8) | {
"end_col": 69,
"end_line": 190,
"start_col": 2,
"start_line": 190
} |
Prims.Tot | val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64 | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8 | val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i = | false | null | false | let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8 | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Lib.ByteSequence.lbytes",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Lib.IntTypes.size_nat",
"Prims.op_LessThan",
"Lib.ByteSequence.uint_from_bytes_le",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.Sequence.sub",
"Prims.op_Multiply",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_or",
"Prims.op_Addition",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index",
"Lib.Sequence.update_sub",
"Lib.IntTypes.uint_t",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.create",
"Lib.IntTypes.mk_int",
"Prims.l_imp",
"Lib.Sequence.create",
"Lib.IntTypes.u8",
"Lib.IntTypes.uint64"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64 | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64 | [] | Spec.Frodo.Encode.frodo_key_encode1 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b <= logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Lib.ByteSequence.lbytes ((n * n) * b / 8) ->
i: Lib.IntTypes.size_nat{i < n}
-> Lib.IntTypes.uint64 | {
"end_col": 28,
"end_line": 137,
"start_col": 36,
"start_line": 134
} |
Prims.Tot | val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64 | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frodo_key_decode0 logq b n a i k templong =
templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k) | val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64
let frodo_key_decode0 logq b n a i k templong = | false | null | false | templong |. to_u64 (dc logq b a.(i, k)) <<. size (b * k) | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Spec.Matrix.matrix",
"Lib.IntTypes.size_nat",
"Lib.IntTypes.uint64",
"Lib.IntTypes.op_Bar_Dot",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.IntTypes.op_Less_Less_Dot",
"Lib.IntTypes.to_u64",
"Lib.IntTypes.U16",
"Spec.Frodo.Encode.dc",
"Spec.Matrix.op_Array_Access",
"FStar.Pervasives.Native.Mktuple2",
"Lib.IntTypes.size",
"FStar.Mul.op_Star"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res
val ec1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> x:uint64
-> k:size_nat{k < 8}
-> Pure uint16
(requires True)
(ensures fun res ->
let rk = v x / pow2 (b * k) % pow2 b in
Math.Lemmas.pow2_lt_compat 16 b;
res == ec logq b (u16 rk))
let ec1 logq b x k =
let rk = (x >>. size (b * k)) &. ((u64 1 <<. size b) -. u64 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v rk;
(==) { modulo_pow2_u64 (x >>. size (b * k)) b }
v (x >>. size (b * k)) % pow2 b;
(==) { }
v x / pow2 (b * k) % pow2 b;
};
ec logq b (to_u16 rk)
val frodo_key_encode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> x:uint64
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> res:matrix n n
-> matrix n n
let frodo_key_encode0 logq b n a x i k res =
res.(i, k) <- ec1 logq b x k
val frodo_key_encode1:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> uint64
let frodo_key_encode1 logq b n a i =
let v8 = LSeq.create 8 (u8 0) in
let v8 = update_sub v8 0 b (LSeq.sub a (i * b) b) in
uint_from_bytes_le #U64 v8
val frodo_key_encode2:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> i:size_nat{i < n}
-> res:matrix n n
-> matrix n n
let frodo_key_encode2 logq b n a i res =
let x = frodo_key_encode1 logq b n a i in
Loops.repeati 8 (frodo_key_encode0 logq b n a x i) res
val frodo_key_encode:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:lbytes (n * n * b / 8)
-> matrix n n
let frodo_key_encode logq b n a =
let res = create n n in
Loops.repeati n (frodo_key_encode2 logq b n a) res
val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64 | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val frodo_key_decode0:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq /\ b <= 8}
-> n:size_pos{n == 8}
-> a:matrix n n
-> i:size_nat{i < n}
-> k:size_nat{k < 8}
-> templong:uint64
-> uint64 | [] | Spec.Frodo.Encode.frodo_key_decode0 | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b < logq /\ b <= 8} ->
n: Lib.IntTypes.size_pos{n == 8} ->
a: Spec.Matrix.matrix n n ->
i: Lib.IntTypes.size_nat{i < n} ->
k: Lib.IntTypes.size_nat{k < 8} ->
templong: Lib.IntTypes.uint64
-> Lib.IntTypes.uint64 | {
"end_col": 58,
"end_line": 177,
"start_col": 2,
"start_line": 177
} |
Prims.Pure | val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Spec.Frodo.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Matrix",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Frodo",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let dc logq b c =
let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc (==) {
v res1;
(==) { }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) 16 (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc (==) {
v res;
(==) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) b (16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res | val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b)
let dc logq b c = | false | null | false | let res1 = (c +. (u16 1 <<. size (logq - b - 1))) >>. size (logq - b) in
Math.Lemmas.pow2_lt_compat 16 (16 - logq + b);
calc ( == ) {
v res1;
( == ) { () }
(((v c + pow2 (logq - b - 1) % modulus U16) % modulus U16) / pow2 (logq - b)) % modulus U16;
( == ) { Math.Lemmas.lemma_mod_plus_distr_r (v c) (pow2 (logq - b - 1)) (modulus U16) }
(((v c + pow2 (logq - b - 1)) % modulus U16) / pow2 (logq - b)) % modulus U16;
( == ) { Math.Lemmas.pow2_modulo_division_lemma_1 (v c + pow2 (logq - b - 1)) (logq - b) 16 }
(((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b)) % modulus U16;
( == ) { Math.Lemmas.pow2_modulo_modulo_lemma_2 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b))
16
(16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 (16 - logq + b);
};
let res = res1 &. ((u16 1 <<. size b) -. u16 1) in
Math.Lemmas.pow2_lt_compat 16 b;
calc ( == ) {
v res;
( == ) { modulo_pow2_u16 res1 b }
v res1 % pow2 b;
( == ) { Math.Lemmas.pow2_modulo_modulo_lemma_1 ((v c + pow2 (logq - b - 1)) / pow2 (logq - b))
b
(16 - logq + b) }
((v c + pow2 (logq - b - 1)) / pow2 (logq - b)) % pow2 b;
};
res | {
"checked_file": "Spec.Frodo.Encode.fst.checked",
"dependencies": [
"Spec.Matrix.fst.checked",
"Spec.Frodo.Lemmas.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Frodo.Encode.fst"
} | [] | [
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Lib.IntTypes.uint16",
"Prims.unit",
"FStar.Calc.calc_finish",
"Lib.IntTypes.range_t",
"Lib.IntTypes.U16",
"Prims.eq2",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Prims.op_Modulus",
"Prims.op_Division",
"Prims.op_Addition",
"Prims.pow2",
"Prims.op_Subtraction",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Spec.Frodo.Lemmas.modulo_pow2_u16",
"Prims.squash",
"FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1",
"FStar.Math.Lemmas.pow2_lt_compat",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Amp_Dot",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.op_Less_Less_Dot",
"Lib.IntTypes.u16",
"Lib.IntTypes.size",
"Lib.IntTypes.modulus",
"FStar.Math.Lemmas.lemma_mod_plus_distr_r",
"FStar.Math.Lemmas.pow2_modulo_division_lemma_1",
"FStar.Math.Lemmas.pow2_modulo_modulo_lemma_2",
"Lib.IntTypes.op_Greater_Greater_Dot",
"Lib.IntTypes.op_Plus_Dot"
] | [] | module Spec.Frodo.Encode
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
open Spec.Matrix
open Spec.Frodo.Lemmas
module LSeq = Lib.Sequence
module Loops = Lib.LoopCombinators
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(** The simplified version of the encode and decode functions when n = params_nbar = 8 *)
val ec:
logq:size_pos{logq <= 16}
-> b:size_pos{b <= logq}
-> k:uint16{v k < pow2 b}
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 logq /\ v r == v k * pow2 (logq - b))
let ec logq b k =
let res = k <<. size (logq - b) in
assert (v res = v k * pow2 (logq - b) % modulus U16);
calc (<) {
v k * pow2 (logq - b);
(<) { Math.Lemmas.lemma_mult_lt_right (pow2 (logq - b)) (v k) (pow2 b) }
pow2 b * pow2 (logq - b);
(==) { Math.Lemmas.pow2_plus b (logq - b) }
pow2 logq;
};
Math.Lemmas.pow2_le_compat 16 logq;
Math.Lemmas.small_modulo_lemma_2 (v k * pow2 (logq - b)) (modulus U16);
assert (v res = v k * pow2 (logq - b));
res
val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b) | false | false | Spec.Frodo.Encode.fst | {
"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"
} | null | val dc:
logq:size_pos{logq <= 16}
-> b:size_pos{b < logq}
-> c:uint16
-> Pure uint16
(requires True)
(ensures fun r ->
v r < pow2 b /\ v r = (v c + pow2 (logq - b - 1)) / pow2 (logq - b) % pow2 b) | [] | Spec.Frodo.Encode.dc | {
"file_name": "specs/frodo/Spec.Frodo.Encode.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
logq: Lib.IntTypes.size_pos{logq <= 16} ->
b: Lib.IntTypes.size_pos{b < logq} ->
c: Lib.IntTypes.uint16
-> Prims.Pure Lib.IntTypes.uint16 | {
"end_col": 5,
"end_line": 81,
"start_col": 17,
"start_line": 55
} |
Prims.Tot | val rotate_l (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rotate_l (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kl vl _ l (Node kr vr _ lr rr) -> mkNode kr vr (mkNode kl vl l lr) rr
| _ -> t | val rotate_l (#a: eqtype) (#b: Type) (t: tree a b) : tree a b
let rotate_l (#a: eqtype) (#b: Type) (t: tree a b) : tree a b = | false | null | false | match t with
| Node kl vl _ l (Node kr vr _ lr rr) -> mkNode kr vr (mkNode kl vl l lr) rr
| _ -> t | {
"checked_file": "Vale.Lib.MapTree.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.MapTree.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Vale.Lib.MapTree.tree",
"Prims.nat",
"Vale.Lib.MapTree.mkNode"
] | [] | module Vale.Lib.MapTree
open FStar.Mul
(** Balanced tree implementation *)
type tree (a:eqtype) (b:Type) =
| Empty : tree a b
| Node : a -> b -> nat -> tree a b -> tree a b -> tree a b
let height (#a:eqtype) (#b:Type) (t:tree a b) : nat =
match t with
| Empty -> 0
| Node _ _ h _ _ -> h
let mkNode (#a:eqtype) (#b:Type) (key:a) (value:b) (l r:tree a b) : tree a b =
let hl = height l in
let hr = height r in
let h = if hl > hr then hl else hr in
Node key value (h + 1) l r | false | false | Vale.Lib.MapTree.fst | {
"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"
} | null | val rotate_l (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [] | Vale.Lib.MapTree.rotate_l | {
"file_name": "vale/code/lib/collections/Vale.Lib.MapTree.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Vale.Lib.MapTree.tree a b -> Vale.Lib.MapTree.tree a b | {
"end_col": 10,
"end_line": 24,
"start_col": 2,
"start_line": 22
} |
Prims.Tot | val rotate_r (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rotate_r (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kr vr _ (Node kl vl _ ll rl) r -> mkNode kl vl ll (mkNode kr vr rl r)
| _ -> t | val rotate_r (#a: eqtype) (#b: Type) (t: tree a b) : tree a b
let rotate_r (#a: eqtype) (#b: Type) (t: tree a b) : tree a b = | false | null | false | match t with
| Node kr vr _ (Node kl vl _ ll rl) r -> mkNode kl vl ll (mkNode kr vr rl r)
| _ -> t | {
"checked_file": "Vale.Lib.MapTree.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.MapTree.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Vale.Lib.MapTree.tree",
"Prims.nat",
"Vale.Lib.MapTree.mkNode"
] | [] | module Vale.Lib.MapTree
open FStar.Mul
(** Balanced tree implementation *)
type tree (a:eqtype) (b:Type) =
| Empty : tree a b
| Node : a -> b -> nat -> tree a b -> tree a b -> tree a b
let height (#a:eqtype) (#b:Type) (t:tree a b) : nat =
match t with
| Empty -> 0
| Node _ _ h _ _ -> h
let mkNode (#a:eqtype) (#b:Type) (key:a) (value:b) (l r:tree a b) : tree a b =
let hl = height l in
let hr = height r in
let h = if hl > hr then hl else hr in
Node key value (h + 1) l r
let rotate_l (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kl vl _ l (Node kr vr _ lr rr) -> mkNode kr vr (mkNode kl vl l lr) rr
| _ -> t | false | false | Vale.Lib.MapTree.fst | {
"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"
} | null | val rotate_r (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [] | Vale.Lib.MapTree.rotate_r | {
"file_name": "vale/code/lib/collections/Vale.Lib.MapTree.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Vale.Lib.MapTree.tree a b -> Vale.Lib.MapTree.tree a b | {
"end_col": 10,
"end_line": 29,
"start_col": 2,
"start_line": 27
} |
Prims.Tot | val is_lt_option (#a: eqtype) (is_le: (a -> a -> bool)) (x y: option a) : bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let is_lt_option (#a:eqtype) (is_le:a -> a -> bool) (x y:option a) : bool =
match (x, y) with
| (Some x, Some y) -> is_le x y && x <> y
| _ -> true | val is_lt_option (#a: eqtype) (is_le: (a -> a -> bool)) (x y: option a) : bool
let is_lt_option (#a: eqtype) (is_le: (a -> a -> bool)) (x y: option a) : bool = | false | null | false | match (x, y) with
| Some x, Some y -> is_le x y && x <> y
| _ -> true | {
"checked_file": "Vale.Lib.MapTree.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.MapTree.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Prims.bool",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_AmpAmp",
"Prims.op_disEquality",
"FStar.Pervasives.Native.tuple2"
] | [] | module Vale.Lib.MapTree
open FStar.Mul
(** Balanced tree implementation *)
type tree (a:eqtype) (b:Type) =
| Empty : tree a b
| Node : a -> b -> nat -> tree a b -> tree a b -> tree a b
let height (#a:eqtype) (#b:Type) (t:tree a b) : nat =
match t with
| Empty -> 0
| Node _ _ h _ _ -> h
let mkNode (#a:eqtype) (#b:Type) (key:a) (value:b) (l r:tree a b) : tree a b =
let hl = height l in
let hr = height r in
let h = if hl > hr then hl else hr in
Node key value (h + 1) l r
let rotate_l (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kl vl _ l (Node kr vr _ lr rr) -> mkNode kr vr (mkNode kl vl l lr) rr
| _ -> t
let rotate_r (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kr vr _ (Node kl vl _ ll rl) r -> mkNode kl vl ll (mkNode kr vr rl r)
| _ -> t
let balance (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node _ _ _ l r ->
let hl = height l in
let hr = height r in
if hl >= hr + 2 then rotate_r t else
if hr >= hl + 2 then rotate_l t else
t
| _ -> t
let rec get (#a:eqtype) (#b:Type) (is_le:a -> a -> bool) (t:tree a b) (key:a) : option b =
match t with
| Empty -> None
| Node k v h l r ->
if key = k then Some v
else if is_le key k then
get is_le l key
else
get is_le r key
let rec put (#a:eqtype) (#b:Type) (is_le:a -> a -> bool) (t:tree a b) (key:a) (value:b) : tree a b =
match t with
| Empty -> mkNode key value Empty Empty
| Node k v _ l r ->
if key = k then mkNode k value l r
else if is_le key k then
balance (mkNode k v (put is_le l key value) r)
else
balance (mkNode k v l (put is_le r key value))
(** Invariants and proofs of get-put correctness *) | false | false | Vale.Lib.MapTree.fst | {
"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"
} | null | val is_lt_option (#a: eqtype) (is_le: (a -> a -> bool)) (x y: option a) : bool | [] | Vale.Lib.MapTree.is_lt_option | {
"file_name": "vale/code/lib/collections/Vale.Lib.MapTree.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
is_le: (_: a -> _: a -> Prims.bool) ->
x: FStar.Pervasives.Native.option a ->
y: FStar.Pervasives.Native.option a
-> Prims.bool | {
"end_col": 13,
"end_line": 66,
"start_col": 2,
"start_line": 64
} |
Prims.Tot | val balance (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let balance (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node _ _ _ l r ->
let hl = height l in
let hr = height r in
if hl >= hr + 2 then rotate_r t else
if hr >= hl + 2 then rotate_l t else
t
| _ -> t | val balance (#a: eqtype) (#b: Type) (t: tree a b) : tree a b
let balance (#a: eqtype) (#b: Type) (t: tree a b) : tree a b = | false | null | false | match t with
| Node _ _ _ l r ->
let hl = height l in
let hr = height r in
if hl >= hr + 2 then rotate_r t else if hr >= hl + 2 then rotate_l t else t
| _ -> t | {
"checked_file": "Vale.Lib.MapTree.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.MapTree.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Vale.Lib.MapTree.tree",
"Prims.nat",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Addition",
"Vale.Lib.MapTree.rotate_r",
"Prims.bool",
"Vale.Lib.MapTree.rotate_l",
"Vale.Lib.MapTree.height"
] | [] | module Vale.Lib.MapTree
open FStar.Mul
(** Balanced tree implementation *)
type tree (a:eqtype) (b:Type) =
| Empty : tree a b
| Node : a -> b -> nat -> tree a b -> tree a b -> tree a b
let height (#a:eqtype) (#b:Type) (t:tree a b) : nat =
match t with
| Empty -> 0
| Node _ _ h _ _ -> h
let mkNode (#a:eqtype) (#b:Type) (key:a) (value:b) (l r:tree a b) : tree a b =
let hl = height l in
let hr = height r in
let h = if hl > hr then hl else hr in
Node key value (h + 1) l r
let rotate_l (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kl vl _ l (Node kr vr _ lr rr) -> mkNode kr vr (mkNode kl vl l lr) rr
| _ -> t
let rotate_r (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =
match t with
| Node kr vr _ (Node kl vl _ ll rl) r -> mkNode kl vl ll (mkNode kr vr rl r)
| _ -> t | false | false | Vale.Lib.MapTree.fst | {
"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"
} | null | val balance (#a: eqtype) (#b: Type) (t: tree a b) : tree a b | [] | Vale.Lib.MapTree.balance | {
"file_name": "vale/code/lib/collections/Vale.Lib.MapTree.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Vale.Lib.MapTree.tree a b -> Vale.Lib.MapTree.tree a b | {
"end_col": 10,
"end_line": 39,
"start_col": 2,
"start_line": 32
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.