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": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i} | let generate_elems4_a (t a: Type0) (max: nat) (i: nat{i <= max / 4}) = | false | null | false | a & s: seq t {length s == 4 * i} | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Division",
"FStar.Pervasives.Native.tuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i | false | false | Hacl.Spec.Lib.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 generate_elems4_a : t: Type0 -> a: Type0 -> max: Prims.nat -> i: Prims.nat{i <= max / 4} -> Type0 | [] | Hacl.Spec.Lib.generate_elems4_a | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Type0 -> a: Type0 -> max: Prims.nat -> i: Prims.nat{i <= max / 4} -> Type0 | {
"end_col": 106,
"end_line": 74,
"start_col": 76,
"start_line": 74
} |
|
Prims.Tot | val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2 | val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init = | false | null | false | let init2:generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2 | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.LoopCombinators.repeat_gen",
"Hacl.Spec.Lib.generate_elem_a",
"Hacl.Spec.Lib.generate_elem_f",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Lib.Sequence.length",
"FStar.Seq.Base.empty"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | false | false | Hacl.Spec.Lib.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 generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | [] | Hacl.Spec.Lib.generate_elems | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> a * s: Lib.Sequence.seq t {Lib.Sequence.length s == n} | {
"end_col": 76,
"end_line": 41,
"start_col": 39,
"start_line": 39
} |
Prims.Tot | val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1) | val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init = | false | null | false | let c0, res0 =
Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty)
in
let c1, res1 =
Loops.repeat_right ((n / 4) * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0)
in
(c1, res1) | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"Prims.op_Division",
"FStar.Pervasives.Native.Mktuple2",
"Hacl.Spec.Lib.generate_elem_a",
"Lib.LoopCombinators.repeat_right",
"Hacl.Spec.Lib.generate_elem_f",
"Hacl.Spec.Lib.generate_elems4_a",
"Lib.LoopCombinators.repeat_gen",
"Hacl.Spec.Lib.generate_elems4_f",
"FStar.Seq.Base.empty"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | false | false | Hacl.Spec.Lib.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 generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n}) | [] | Hacl.Spec.Lib.generate_elems_unroll4 | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> a * s: Lib.Sequence.seq t {Lib.Sequence.length s == n} | {
"end_col": 12,
"end_line": 110,
"start_col": 47,
"start_line": 107
} |
FStar.Pervasives.Lemma | val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty)) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2 | val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init = | false | null | true | let init2:generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2 | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.LoopCombinators.eq_repeat_gen0",
"Hacl.Spec.Lib.generate_elem_a",
"Hacl.Spec.Lib.generate_elem_f",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Lib.Sequence.length",
"FStar.Seq.Base.empty",
"Prims.unit"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty)) | false | false | Hacl.Spec.Lib.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 eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty)) | [] | Hacl.Spec.Lib.eq_generate_elems0 | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> FStar.Pervasives.Lemma
(ensures
Hacl.Spec.Lib.generate_elems max 0 f init ==
FStar.Pervasives.Native.Mktuple2 init FStar.Seq.Base.empty) | {
"end_col": 80,
"end_line": 55,
"start_col": 43,
"start_line": 53
} |
Prims.Tot | val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res' | val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) = | false | null | false | let c', e = f i c in
let res' = Seq.snoc res e in
c', res' | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Lib.generate_elem_a",
"Lib.Sequence.seq",
"Prims.eq2",
"Lib.Sequence.length",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_Addition",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.snoc"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1) | false | false | Hacl.Spec.Lib.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 generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1) | [] | Hacl.Spec.Lib.generate_elem_f | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max: Prims.nat ->
f: (i: Prims.nat{i < max} -> _: a -> a * t) ->
i: Prims.nat{i < max} ->
acc: Hacl.Spec.Lib.generate_elem_a t a max i
-> Hacl.Spec.Lib.generate_elem_a t a max (i + 1) | {
"end_col": 10,
"end_line": 27,
"start_col": 44,
"start_line": 24
} |
FStar.Pervasives.Lemma | val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init)) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i | val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i = | false | null | true | let init2:generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.LoopCombinators.unfold_repeat_gen",
"Prims.op_Addition",
"Hacl.Spec.Lib.generate_elem_a",
"Hacl.Spec.Lib.generate_elem_f",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Lib.Sequence.length",
"FStar.Seq.Base.empty",
"Prims.unit"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init)) | false | false | Hacl.Spec.Lib.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 generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init)) | [] | Hacl.Spec.Lib.generate_elems_unfold | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max: Prims.nat ->
n: Prims.nat{n <= max} ->
f: (i: Prims.nat{i < max} -> _: a -> a * t) ->
init: a ->
i: Prims.nat{i < n}
-> FStar.Pervasives.Lemma
(ensures
Hacl.Spec.Lib.generate_elems max (i + 1) f init ==
Hacl.Spec.Lib.generate_elem_f max f i (Hacl.Spec.Lib.generate_elems max i f init)) | {
"end_col": 91,
"end_line": 71,
"start_col": 48,
"start_line": 69
} |
Prims.Tot | val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3 | val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) = | false | null | false | let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3 | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Prims.op_Division",
"Hacl.Spec.Lib.generate_elems4_a",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_Addition",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.snoc"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1) | false | false | Hacl.Spec.Lib.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 generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1) | [] | Hacl.Spec.Lib.generate_elems4_f | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max: Prims.nat ->
f: (i: Prims.nat{i < max} -> _: a -> a * t) ->
i: Prims.nat{i < max / 4} ->
acc: Hacl.Spec.Lib.generate_elems4_a t a max i
-> Hacl.Spec.Lib.generate_elems4_a t a max (i + 1) | {
"end_col": 10,
"end_line": 95,
"start_col": 46,
"start_line": 85
} |
Prims.Tot | val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 generate_blocks4_f #t #a max f i c =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
c3, Lib.Sequence.create4 e0 e1 e2 e3 | val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4)
let generate_blocks4_f #t #a max f i c = | false | null | false | let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
c3, Lib.Sequence.create4 e0 e1 e2 e3 | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.lseq",
"Lib.Sequence.create4",
"Prims.op_Addition"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init)
let lemma_generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
let (c2, res2) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let (c3, res3) = Loops.repeat_gen (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0 (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max (n / 4 * 4) f init
val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4) | false | false | Hacl.Spec.Lib.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 generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4) | [] | Hacl.Spec.Lib.generate_blocks4_f | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Prims.nat -> f: (i: Prims.nat{i < 4 * k} -> _: a -> a * t) -> i: Prims.nat{i < k} -> c: a
-> a * Lib.Sequence.lseq t 4 | {
"end_col": 38,
"end_line": 191,
"start_col": 40,
"start_line": 186
} |
FStar.Pervasives.Lemma | val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 lemma_generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
let (c2, res2) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let (c3, res3) = Loops.repeat_gen (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0 (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max (n / 4 * 4) f init | val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init)
let lemma_generate_elems_unroll4 #t #a max n f init = | false | null | true | let c0, res0 =
Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty)
in
let c1, res1 =
Loops.repeat_right ((n / 4) * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0)
in
let c2, res2 =
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
in
let c3, res3 =
Loops.repeat_gen ((n / 4) * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0
((n / 4) * 4)
n
(generate_elem_a t a max)
(generate_elem_f max f)
(init, Seq.empty);
Loops.repeat_gen_def ((n / 4) * 4)
(generate_elem_a t a max)
(generate_elem_f max f)
(init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max ((n / 4) * 4) f init | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"Prims.op_Division",
"Hacl.Spec.Lib.lemma_generate_elems_unroll4_loop",
"Prims.unit",
"Lib.LoopCombinators.repeat_gen_def",
"Hacl.Spec.Lib.generate_elem_a",
"Hacl.Spec.Lib.generate_elem_f",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.empty",
"Lib.LoopCombinators.repeat_right_plus",
"Prims.op_Multiply",
"Lib.LoopCombinators.repeat_gen",
"Lib.LoopCombinators.repeat_right",
"Hacl.Spec.Lib.generate_elems4_a",
"Hacl.Spec.Lib.generate_elems4_f"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init) | false | false | Hacl.Spec.Lib.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 lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init) | [] | Hacl.Spec.Lib.lemma_generate_elems_unroll4 | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> FStar.Pervasives.Lemma
(ensures
Hacl.Spec.Lib.generate_elems_unroll4 max n f init == Hacl.Spec.Lib.generate_elems max n f init
) | {
"end_col": 64,
"end_line": 174,
"start_col": 53,
"start_line": 165
} |
FStar.Pervasives.Lemma | val lemma_generate_elems4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c, res) = generate_elems #t #a max n f init in
let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c1, res1) in
c == c2 /\ res == res2) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 lemma_generate_elems4 #t #a max n f init =
lemma_generate_elems4_loop #t #a max n f init;
lemma_generate_elems_unroll4 #t #a max n f init | val lemma_generate_elems4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c, res) = generate_elems #t #a max n f init in
let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c1, res1) in
c == c2 /\ res == res2)
let lemma_generate_elems4 #t #a max n f init = | false | null | true | lemma_generate_elems4_loop #t #a max n f init;
lemma_generate_elems_unroll4 #t #a max n f init | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Lib.lemma_generate_elems_unroll4",
"Prims.unit",
"Hacl.Spec.Lib.lemma_generate_elems4_loop"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init)
let lemma_generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
let (c2, res2) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let (c3, res3) = Loops.repeat_gen (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0 (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max (n / 4 * 4) f init
val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4)
let generate_blocks4_f #t #a max f i c =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
c3, Lib.Sequence.create4 e0 e1 e2 e3
val lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1)
let lemma_generate_elems4_loop_step #t #a max k f i c s =
let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res = Lib.Sequence.create4 e0 e1 e2 e3 in
let res0 = Seq.snoc s e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
Seq.lemma_eq_intro (Seq.append s res) res3
val lemma_generate_elems4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
c1 == c2 /\ res1 == res2)
let rec lemma_generate_elems4_loop #t #a max n f init =
let k = n / 4 in
let (c1, res1) = generate_blocks 4 (max / 4) k (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
if k = 0 then begin
eq_generate_blocks0 4 (max / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init;
Loops.eq_repeat_gen0 k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) end
else begin
lemma_generate_elems4_loop #t #a max (n - 4) f init;
let (c3, res3) = generate_blocks 4 (max / 4) (k - 1) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c4, res4) = Loops.repeat_gen (k - 1) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
//assert (c3 == c4 /\ res3 == res4);
unfold_generate_blocks 4 (max / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init (k - 1);
Loops.unfold_repeat_gen k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) (k - 1);
//let (acc', s') = generate_blocks4_f #t #a (max / 4) f (k - 1) c3 in
//assert (res1 == Seq.append res3 s');
lemma_generate_elems4_loop_step #t #a max k f (k - 1) c3 res3;
() end
val lemma_generate_elems4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c, res) = generate_elems #t #a max n f init in
let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c1, res1) in
c == c2 /\ res == res2) | false | false | Hacl.Spec.Lib.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 lemma_generate_elems4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c, res) = generate_elems #t #a max n f init in
let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c1, res1) in
c == c2 /\ res == res2) | [] | Hacl.Spec.Lib.lemma_generate_elems4 | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> FStar.Pervasives.Lemma
(ensures
(let _ = Hacl.Spec.Lib.generate_elems max n f init in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c res = _ in
let _ =
Lib.Sequence.generate_blocks 4
(max / 4)
(n / 4)
(Lib.LoopCombinators.fixed_a a)
(Hacl.Spec.Lib.generate_blocks4_f (max / 4) f)
init
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c1 res1 = _ in
let _ =
Lib.LoopCombinators.repeat_right ((n / 4) * 4)
n
(Hacl.Spec.Lib.generate_elem_a t a max)
(Hacl.Spec.Lib.generate_elem_f max f)
(c1, res1)
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c2 res2 = _ in
c == c2 /\ res == res2)
<:
Type0)
<:
Type0)
<:
Type0)) | {
"end_col": 49,
"end_line": 271,
"start_col": 2,
"start_line": 270
} |
FStar.Pervasives.Lemma | val lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 lemma_generate_elems4_loop_step #t #a max k f i c s =
let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res = Lib.Sequence.create4 e0 e1 e2 e3 in
let res0 = Seq.snoc s e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
Seq.lemma_eq_intro (Seq.append s res) res3 | val lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1)
let lemma_generate_elems4_loop_step #t #a max k f i c s = | false | null | true | let c1, res1 = generate_elems4_f #t #a max f i (c, s) in
let c2, res2 = generate_blocks4_f #t #a k f i c in
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res = Lib.Sequence.create4 e0 e1 e2 e3 in
let res0 = Seq.snoc s e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
Seq.lemma_eq_intro (Seq.append s res) res3 | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"Prims.op_Addition",
"Lib.Sequence.lseq",
"FStar.Seq.Base.lemma_eq_intro",
"FStar.Seq.Base.append",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.snoc",
"Lib.Sequence.create4",
"Prims.unit",
"Hacl.Spec.Lib.generate_blocks4_f",
"Hacl.Spec.Lib.generate_elems4_a",
"Hacl.Spec.Lib.generate_elems4_f",
"FStar.Pervasives.Native.Mktuple2"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init)
let lemma_generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
let (c2, res2) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let (c3, res3) = Loops.repeat_gen (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0 (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max (n / 4 * 4) f init
val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4)
let generate_blocks4_f #t #a max f i c =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
c3, Lib.Sequence.create4 e0 e1 e2 e3
val lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1) | false | false | Hacl.Spec.Lib.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 lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1) | [] | Hacl.Spec.Lib.lemma_generate_elems4_loop_step | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max: Prims.nat ->
k: Prims.nat{4 * k <= max} ->
f: (i: Prims.nat{i < max} -> _: a -> a * t) ->
i: Prims.nat{i < k} ->
c: a ->
s: Lib.Sequence.seq t {Lib.Sequence.length s == 4 * i}
-> FStar.Pervasives.Lemma
(ensures
(let _ = Hacl.Spec.Lib.generate_elems4_f max f i (c, s) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c1 res1 = _ in
let _ = Hacl.Spec.Lib.generate_blocks4_f k f i c in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c2 res2 = _ in
c1 == c2 /\ FStar.Seq.Base.append s res2 == res1)
<:
Type0)
<:
Type0)) | {
"end_col": 44,
"end_line": 222,
"start_col": 57,
"start_line": 208
} |
FStar.Pervasives.Lemma | val lemma_generate_elems4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
c1 == c2 /\ res1 == res2) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 rec lemma_generate_elems4_loop #t #a max n f init =
let k = n / 4 in
let (c1, res1) = generate_blocks 4 (max / 4) k (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
if k = 0 then begin
eq_generate_blocks0 4 (max / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init;
Loops.eq_repeat_gen0 k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) end
else begin
lemma_generate_elems4_loop #t #a max (n - 4) f init;
let (c3, res3) = generate_blocks 4 (max / 4) (k - 1) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c4, res4) = Loops.repeat_gen (k - 1) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
//assert (c3 == c4 /\ res3 == res4);
unfold_generate_blocks 4 (max / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init (k - 1);
Loops.unfold_repeat_gen k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) (k - 1);
//let (acc', s') = generate_blocks4_f #t #a (max / 4) f (k - 1) c3 in
//assert (res1 == Seq.append res3 s');
lemma_generate_elems4_loop_step #t #a max k f (k - 1) c3 res3;
() end | val lemma_generate_elems4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
c1 == c2 /\ res1 == res2)
let rec lemma_generate_elems4_loop #t #a max n f init = | false | null | true | let k = n / 4 in
let c1, res1 =
generate_blocks 4 (max / 4) k (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init
in
let c2, res2 =
Loops.repeat_gen k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty)
in
if k = 0
then
(eq_generate_blocks0 4 (max / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init;
Loops.eq_repeat_gen0 k (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty))
else
(lemma_generate_elems4_loop #t #a max (n - 4) f init;
let c3, res3 =
generate_blocks 4
(max / 4)
(k - 1)
(Loops.fixed_a a)
(generate_blocks4_f #t #a (max / 4) f)
init
in
let c4, res4 =
Loops.repeat_gen (k - 1)
(generate_elems4_a t a max)
(generate_elems4_f max f)
(init, Seq.empty)
in
unfold_generate_blocks 4
(max / 4)
(Loops.fixed_a a)
(generate_blocks4_f #t #a (max / 4) f)
init
(k - 1);
Loops.unfold_repeat_gen k
(generate_elems4_a t a max)
(generate_elems4_f max f)
(init, Seq.empty)
(k - 1);
lemma_generate_elems4_loop_step #t #a max k f (k - 1) c3 res3;
()) | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.LoopCombinators.fixed_a",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"Prims.op_Equality",
"Lib.LoopCombinators.eq_repeat_gen0",
"Hacl.Spec.Lib.generate_elems4_a",
"Hacl.Spec.Lib.generate_elems4_f",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.empty",
"Prims.unit",
"Lib.Sequence.eq_generate_blocks0",
"Prims.op_Division",
"Hacl.Spec.Lib.generate_blocks4_f",
"Prims.bool",
"Prims.op_Subtraction",
"Hacl.Spec.Lib.lemma_generate_elems4_loop_step",
"Lib.LoopCombinators.unfold_repeat_gen",
"Lib.Sequence.unfold_generate_blocks",
"Lib.LoopCombinators.repeat_gen",
"Prims.op_Multiply",
"Lib.Sequence.generate_blocks",
"Hacl.Spec.Lib.lemma_generate_elems4_loop"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty)
val lemma_generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems_unroll4 #t #a max n f init == generate_elems #t #a max n f init)
let lemma_generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
let (c2, res2) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let (c3, res3) = Loops.repeat_gen (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_right_plus 0 (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4 * 4) (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty);
lemma_generate_elems_unroll4_loop #t #a max (n / 4 * 4) f init
val generate_blocks4_f:
#t:Type0
-> #a:Type0
-> k:nat
-> f:(i:nat{i < 4 * k} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> tuple2 a (lseq t 4)
let generate_blocks4_f #t #a max f i c =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
c3, Lib.Sequence.create4 e0 e1 e2 e3
val lemma_generate_elems4_loop_step:
#t:Type0
-> #a:Type0
-> max:nat
-> k:nat{4 * k <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < k}
-> c:a
-> s:seq t{length s == 4 * i} ->
Lemma
(let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
c1 == c2 /\ Seq.append s res2 == res1)
let lemma_generate_elems4_loop_step #t #a max k f i c s =
let (c1, res1) = generate_elems4_f #t #a max f i (c, s) in
let (c2, res2) = generate_blocks4_f #t #a k f i c in
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res = Lib.Sequence.create4 e0 e1 e2 e3 in
let res0 = Seq.snoc s e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
Seq.lemma_eq_intro (Seq.append s res) res3
val lemma_generate_elems4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
c1 == c2 /\ res1 == res2) | false | false | Hacl.Spec.Lib.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 lemma_generate_elems4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a -> Lemma
(let (c1, res1) = generate_blocks 4 (max / 4) (n / 4) (Loops.fixed_a a) (generate_blocks4_f #t #a (max / 4) f) init in
let (c2, res2) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
c1 == c2 /\ res1 == res2) | [
"recursion"
] | Hacl.Spec.Lib.lemma_generate_elems4_loop | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max: Prims.nat -> n: Prims.nat{n <= max} -> f: (i: Prims.nat{i < max} -> _: a -> a * t) -> init: a
-> FStar.Pervasives.Lemma
(ensures
(let _ =
Lib.Sequence.generate_blocks 4
(max / 4)
(n / 4)
(Lib.LoopCombinators.fixed_a a)
(Hacl.Spec.Lib.generate_blocks4_f (max / 4) f)
init
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c1 res1 = _ in
let _ =
Lib.LoopCombinators.repeat_gen (n / 4)
(Hacl.Spec.Lib.generate_elems4_a t a max)
(Hacl.Spec.Lib.generate_elems4_f max f)
(init, FStar.Seq.Base.empty)
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c2 res2 = _ in
c1 == c2 /\ res1 == res2)
<:
Type0)
<:
Type0)) | {
"end_col": 10,
"end_line": 254,
"start_col": 55,
"start_line": 236
} |
FStar.Pervasives.Lemma | val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1) | [
{
"abbrev": true,
"full_module": "Lib.Vec.Lemmas",
"short_module": "VecLemmas"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.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 lemma_generate_elems_unroll4_loop #t #a max n f init =
let acc_v = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i:nat{i <= n / 4}) (acc_v:generate_elems4_a t a max i) : generate_elem_a t a max (4 * i) =
let (c, res) = acc_v in
(c, res) in
let aux (i:nat{i < n / 4}) (acc_v:generate_elems4_a t a max i) : Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i) (4 * i + 4)
(generate_elem_a t a max) (generate_elem_f max f) (normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc = Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 in
Loops.unfold_repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 3);
Loops.unfold_repeat_right (4 * i) (4 * i + 3) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 2);
Loops.unfold_repeat_right (4 * i) (4 * i + 2) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i + 1);
Loops.unfold_repeat_right (4 * i) (4 * i + 1) (generate_elem_a t a max) (generate_elem_f max f) acc0 (4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
() in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4 (n / 4) (generate_elem_a t a max) (generate_elems4_a t a max) normalize_v
(generate_elem_f max f) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) | val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1)
let lemma_generate_elems_unroll4_loop #t #a max n f init = | false | null | true | let acc_v =
Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty)
in
let acc = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
let normalize_v (i: nat{i <= n / 4}) (acc_v: generate_elems4_a t a max i)
: generate_elem_a t a max (4 * i) =
let c, res = acc_v in
(c, res)
in
let aux (i: nat{i < n / 4}) (acc_v: generate_elems4_a t a max i)
: Lemma
(normalize_v (i + 1) (generate_elems4_f max f i acc_v) ==
Loops.repeat_right (4 * i)
(4 * i + 4)
(generate_elem_a t a max)
(generate_elem_f max f)
(normalize_v i acc_v)) =
let acc0 = normalize_v i acc_v in
let acc =
Loops.repeat_right (4 * i) (4 * i + 4) (generate_elem_a t a max) (generate_elem_f max f) acc0
in
Loops.unfold_repeat_right (4 * i)
(4 * i + 4)
(generate_elem_a t a max)
(generate_elem_f max f)
acc0
(4 * i + 3);
Loops.unfold_repeat_right (4 * i)
(4 * i + 3)
(generate_elem_a t a max)
(generate_elem_f max f)
acc0
(4 * i + 2);
Loops.unfold_repeat_right (4 * i)
(4 * i + 2)
(generate_elem_a t a max)
(generate_elem_f max f)
acc0
(4 * i + 1);
Loops.unfold_repeat_right (4 * i)
(4 * i + 1)
(generate_elem_a t a max)
(generate_elem_f max f)
acc0
(4 * i);
Loops.eq_repeat_right (4 * i) (4 * i) (generate_elem_a t a max) (generate_elem_f max f) acc0;
assert (normalize_v (i + 1) (generate_elems4_f max f i acc_v) == acc);
()
in
Classical.forall_intro_2 aux;
VecLemmas.lemma_repeat_gen_vec 4
(n / 4)
(generate_elem_a t a max)
(generate_elems4_a t a max)
normalize_v
(generate_elem_f max f)
(generate_elems4_f max f)
(init, Seq.empty);
Loops.repeat_gen_def (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty);
Loops.repeat_gen_def n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) | {
"checked_file": "Hacl.Spec.Lib.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Vec.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Lib.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_LessThan",
"FStar.Pervasives.Native.tuple2",
"Lib.LoopCombinators.repeat_gen_def",
"Hacl.Spec.Lib.generate_elem_a",
"Hacl.Spec.Lib.generate_elem_f",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.seq",
"Prims.eq2",
"Lib.Sequence.length",
"FStar.Seq.Base.empty",
"Prims.unit",
"Prims.op_Division",
"Hacl.Spec.Lib.generate_elems4_a",
"Hacl.Spec.Lib.generate_elems4_f",
"FStar.Mul.op_Star",
"Lib.Vec.Lemmas.lemma_repeat_gen_vec",
"FStar.Classical.forall_intro_2",
"Prims.op_Addition",
"Lib.LoopCombinators.repeat_right",
"Prims.l_True",
"Prims.squash",
"Prims.op_Multiply",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Prims._assert",
"Lib.LoopCombinators.eq_repeat_right",
"Lib.LoopCombinators.unfold_repeat_right",
"Lib.LoopCombinators.repeat_gen"
] | [] | module Hacl.Spec.Lib
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module Loops = Lib.LoopCombinators
module VecLemmas = Lib.Vec.Lemmas
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let generate_elem_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max}) = a & s:seq t{length s == i}
val generate_elem_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max}
-> acc:generate_elem_a t a max i ->
generate_elem_a t a max (i + 1)
let generate_elem_f #t #a max f i (c, res) =
let c', e = f i c in
let res' = Seq.snoc res e in
c', res'
val generate_elems:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) init2
val eq_generate_elems0:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma (generate_elems #t #a max 0 f init == (init, Seq.empty))
let eq_generate_elems0 #t #a max n f init =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.eq_repeat_gen0 n (generate_elem_a t a max) (generate_elem_f max f) init2
val generate_elems_unfold:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a
-> i:nat{i < n} -> Lemma
(generate_elems #t #a max (i + 1) f init ==
generate_elem_f max f i (generate_elems #t #a max i f init))
let generate_elems_unfold #t #a max n f init i =
let init2 : generate_elem_a t a max 0 = (init, Seq.empty) in
Loops.unfold_repeat_gen (i + 1) (generate_elem_a t a max) (generate_elem_f max f) init2 i
let generate_elems4_a (t:Type0) (a:Type0) (max:nat) (i:nat{i <= max / 4}) = a & s:seq t{length s == 4 * i}
val generate_elems4_f:
#t:Type0
-> #a:Type0
-> max:nat
-> f:(i:nat{i < max} -> a -> a & t)
-> i:nat{i < max / 4}
-> acc:generate_elems4_a t a max i ->
generate_elems4_a t a max (i + 1)
let generate_elems4_f #t #a max f i (c, res) =
let c0, e0 = f (4 * i) c in
let c1, e1 = f (4 * i + 1) c0 in
let c2, e2 = f (4 * i + 2) c1 in
let c3, e3 = f (4 * i + 3) c2 in
let res0 = Seq.snoc res e0 in
let res1 = Seq.snoc res0 e1 in
let res2 = Seq.snoc res1 e2 in
let res3 = Seq.snoc res2 e3 in
c3, res3
val generate_elems_unroll4:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Tot (a & s:seq t{length s == n})
let generate_elems_unroll4 #t #a max n f init =
let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_right (n / 4 * 4) n (generate_elem_a t a max) (generate_elem_f max f) (c0, res0) in
(c1, res1)
val lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1) | false | false | Hacl.Spec.Lib.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 lemma_generate_elems_unroll4_loop:
#t:Type0
-> #a:Type0
-> max:nat
-> n:nat{n <= max /\ n % 4 = 0}
-> f:(i:nat{i < max} -> a -> a & t)
-> init:a ->
Lemma
(let (c0, res0) = Loops.repeat_gen (n / 4) (generate_elems4_a t a max) (generate_elems4_f max f) (init, Seq.empty) in
let (c1, res1) = Loops.repeat_gen n (generate_elem_a t a max) (generate_elem_f max f) (init, Seq.empty) in
c0 == c1 /\ res0 == res1) | [] | Hacl.Spec.Lib.lemma_generate_elems_unroll4_loop | {
"file_name": "code/bignum/Hacl.Spec.Lib.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max: Prims.nat ->
n: Prims.nat{n <= max /\ n % 4 = 0} ->
f: (i: Prims.nat{i < max} -> _: a -> a * t) ->
init: a
-> FStar.Pervasives.Lemma
(ensures
(let _ =
Lib.LoopCombinators.repeat_gen (n / 4)
(Hacl.Spec.Lib.generate_elems4_a t a max)
(Hacl.Spec.Lib.generate_elems4_f max f)
(init, FStar.Seq.Base.empty)
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c0 res0 = _ in
let _ =
Lib.LoopCombinators.repeat_gen n
(Hacl.Spec.Lib.generate_elem_a t a max)
(Hacl.Spec.Lib.generate_elem_f max f)
(init, FStar.Seq.Base.empty)
in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ c1 res1 = _ in
c0 == c1 /\ res0 == res1)
<:
Type0)
<:
Type0)) | {
"end_col": 92,
"end_line": 153,
"start_col": 58,
"start_line": 125
} |
Prims.Tot | val kind_unit:parser_kind false WeakKindStrongPrefix | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 kind_unit
: parser_kind false WeakKindStrongPrefix
= ret_kind | val kind_unit:parser_kind false WeakKindStrongPrefix
let kind_unit:parser_kind false WeakKindStrongPrefix = | false | null | false | ret_kind | {
"checked_file": "EverParse3d.Kinds.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.Kinds.fsti"
} | [
"total"
] | [
"EverParse3d.Kinds.ret_kind"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module EverParse3d.Kinds
noextract
type weak_kind =
| WeakKindWeak
| WeakKindStrongPrefix
| WeakKindConsumesAll
inline_for_extraction
noextract
let weak_kind_glb
(k1 k2: weak_kind)
: Tot weak_kind
= if k1 = k2
then k1
else WeakKindWeak
inline_for_extraction
noextract
val parser_kind (nz:bool) (wk: weak_kind) : Type0
inline_for_extraction
noextract
val glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
/// Parser: return
inline_for_extraction
noextract
val ret_kind
: parser_kind false WeakKindStrongPrefix
/// Parser: bind
inline_for_extraction
noextract
val and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
inline_for_extraction
noextract
val filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
inline_for_extraction
noextract
val impos_kind
: parser_kind true WeakKindStrongPrefix
/// Lists/arrays
inline_for_extraction
noextract
val kind_nlist
: parser_kind false WeakKindStrongPrefix
val kind_all_bytes
: parser_kind false WeakKindConsumesAll
val kind_t_at_most
: parser_kind false WeakKindStrongPrefix
val kind_t_exact
: parser_kind false WeakKindStrongPrefix
val parse_string_kind
: parser_kind true WeakKindStrongPrefix
val kind_all_zeros
: parser_kind false WeakKindConsumesAll
inline_for_extraction noextract
val kind____UINT8
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT64BE
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT16
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT32
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
val kind____UINT64
: parser_kind true WeakKindStrongPrefix
inline_for_extraction noextract
let kind_unit | false | false | EverParse3d.Kinds.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val kind_unit:parser_kind false WeakKindStrongPrefix | [] | EverParse3d.Kinds.kind_unit | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindStrongPrefix | {
"end_col": 10,
"end_line": 124,
"start_col": 2,
"start_line": 124
} |
Prims.Tot | val weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind | [
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 weak_kind_glb
(k1 k2: weak_kind)
: Tot weak_kind
= if k1 = k2
then k1
else WeakKindWeak | val weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind
let weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind = | false | null | false | if k1 = k2 then k1 else WeakKindWeak | {
"checked_file": "EverParse3d.Kinds.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.Kinds.fsti"
} | [
"total"
] | [
"EverParse3d.Kinds.weak_kind",
"Prims.op_Equality",
"Prims.bool",
"EverParse3d.Kinds.WeakKindWeak"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module EverParse3d.Kinds
noextract
type weak_kind =
| WeakKindWeak
| WeakKindStrongPrefix
| WeakKindConsumesAll
inline_for_extraction
noextract
let weak_kind_glb
(k1 k2: weak_kind) | false | true | EverParse3d.Kinds.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind | [] | EverParse3d.Kinds.weak_kind_glb | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | k1: EverParse3d.Kinds.weak_kind -> k2: EverParse3d.Kinds.weak_kind -> EverParse3d.Kinds.weak_kind | {
"end_col": 19,
"end_line": 32,
"start_col": 2,
"start_line": 30
} |
Prims.Tot | val seq_map (#a #b: Type) (f: (a -> b)) (s: seq a) : seq b | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"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 seq_map (#a #b:Type) (f:a -> b) (s:seq a) : seq b =
init (length s) (compose f (index s)) | val seq_map (#a #b: Type) (f: (a -> b)) (s: seq a) : seq b
let seq_map (#a #b: Type) (f: (a -> b)) (s: seq a) : seq b = | false | null | false | init (length s) (compose f (index s)) | {
"checked_file": "Vale.Lib.Seqs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.Seqs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"FStar.Seq.Base.init",
"FStar.Seq.Base.length",
"Vale.Lib.Seqs_s.compose",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.index"
] | [] | module Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq
let compose (f:'b -> 'c) (g:'a -> 'b) : 'a -> 'c = fun x -> f (g x) | false | false | Vale.Lib.Seqs_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 seq_map (#a #b: Type) (f: (a -> b)) (s: seq a) : seq b | [] | Vale.Lib.Seqs_s.seq_map | {
"file_name": "vale/specs/defs/Vale.Lib.Seqs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: (_: a -> b) -> s: FStar.Seq.Base.seq a -> FStar.Seq.Base.seq b | {
"end_col": 39,
"end_line": 8,
"start_col": 2,
"start_line": 8
} |
Prims.Tot | val compose: f: ('b -> 'c) -> g: ('a -> 'b) -> 'a -> 'c | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"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 compose (f:'b -> 'c) (g:'a -> 'b) : 'a -> 'c = fun x -> f (g x) | val compose: f: ('b -> 'c) -> g: ('a -> 'b) -> 'a -> 'c
let compose (f: ('b -> 'c)) (g: ('a -> 'b)) : 'a -> 'c = | false | null | false | fun x -> f (g x) | {
"checked_file": "Vale.Lib.Seqs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.Seqs_s.fst"
} | [
"total"
] | [] | [] | module Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq | false | false | Vale.Lib.Seqs_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 compose: f: ('b -> 'c) -> g: ('a -> 'b) -> 'a -> 'c | [] | Vale.Lib.Seqs_s.compose | {
"file_name": "vale/specs/defs/Vale.Lib.Seqs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: (_: 'b -> 'c) -> g: (_: 'a -> 'b) -> _: 'a -> 'c | {
"end_col": 67,
"end_line": 5,
"start_col": 51,
"start_line": 5
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"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 all_but_last (s:seq 'a {length s > 0}) =
slice s 0 (length s - 1) | let all_but_last (s: seq 'a {length s > 0}) = | false | null | false | slice s 0 (length s - 1) | {
"checked_file": "Vale.Lib.Seqs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.Seqs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Seq.Base.slice",
"Prims.op_Subtraction"
] | [] | module Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq
let compose (f:'b -> 'c) (g:'a -> 'b) : 'a -> 'c = fun x -> f (g x)
let seq_map (#a #b:Type) (f:a -> b) (s:seq a) : seq b =
init (length s) (compose f (index s)) | false | false | Vale.Lib.Seqs_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 all_but_last : s: FStar.Seq.Base.seq 'a {FStar.Seq.Base.length s > 0} -> FStar.Seq.Base.seq 'a | [] | Vale.Lib.Seqs_s.all_but_last | {
"file_name": "vale/specs/defs/Vale.Lib.Seqs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq 'a {FStar.Seq.Base.length s > 0} -> FStar.Seq.Base.seq 'a | {
"end_col": 26,
"end_line": 11,
"start_col": 2,
"start_line": 11
} |
|
Prims.Tot | val reverse_seq (#a: Type) (s: seq a) : seq a | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"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 reverse_seq (#a:Type) (s:seq a) : seq a =
init (length s) (fun i -> index s (length s - i - 1)) | val reverse_seq (#a: Type) (s: seq a) : seq a
let reverse_seq (#a: Type) (s: seq a) : seq a = | false | null | false | init (length s) (fun i -> index s (length s - i - 1)) | {
"checked_file": "Vale.Lib.Seqs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Lib.Seqs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"FStar.Seq.Base.init",
"FStar.Seq.Base.length",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Prims.op_Subtraction"
] | [] | module Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq
let compose (f:'b -> 'c) (g:'a -> 'b) : 'a -> 'c = fun x -> f (g x)
let seq_map (#a #b:Type) (f:a -> b) (s:seq a) : seq b =
init (length s) (compose f (index s))
let all_but_last (s:seq 'a {length s > 0}) =
slice s 0 (length s - 1) | false | false | Vale.Lib.Seqs_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_seq (#a: Type) (s: seq a) : seq a | [] | Vale.Lib.Seqs_s.reverse_seq | {
"file_name": "vale/specs/defs/Vale.Lib.Seqs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq a -> FStar.Seq.Base.seq a | {
"end_col": 55,
"end_line": 14,
"start_col": 2,
"start_line": 14
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 pow2_24 = 16777216 | let pow2_24 = | false | null | false | 16777216 | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"total"
] | [] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
() | false | true | Vale.Def.Words.Seq.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 pow2_24 : Prims.int | [] | Vale.Def.Words.Seq.pow2_24 | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.int | {
"end_col": 29,
"end_line": 53,
"start_col": 21,
"start_line": 53
} |
|
FStar.Pervasives.Lemma | val two_to_seq_to_two_LE (#a:Type) (x:seq2 a) :
Lemma (two_to_seq_LE (seq_to_two_LE x) == x)
[SMTPat (two_to_seq_LE (seq_to_two_LE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x) | val two_to_seq_to_two_LE (#a:Type) (x:seq2 a) :
Lemma (two_to_seq_LE (seq_to_two_LE x) == x)
[SMTPat (two_to_seq_LE (seq_to_two_LE x))]
let two_to_seq_to_two_LE #a x = | false | null | true | assert (equal (two_to_seq_LE (seq_to_two_LE x)) x) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words.Seq_s.seq2",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.two_to_seq_LE",
"Vale.Def.Words.Seq_s.seq_to_two_LE",
"Prims.unit"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs | false | false | Vale.Def.Words.Seq.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 two_to_seq_to_two_LE (#a:Type) (x:seq2 a) :
Lemma (two_to_seq_LE (seq_to_two_LE x) == x)
[SMTPat (two_to_seq_LE (seq_to_two_LE x))] | [] | Vale.Def.Words.Seq.two_to_seq_to_two_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words.Seq_s.seq2 a
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Words.Seq_s.two_to_seq_LE (Vale.Def.Words.Seq_s.seq_to_two_LE x) == x)
[SMTPat (Vale.Def.Words.Seq_s.two_to_seq_LE (Vale.Def.Words.Seq_s.seq_to_two_LE x))] | {
"end_col": 52,
"end_line": 13,
"start_col": 2,
"start_line": 13
} |
FStar.Pervasives.Lemma | val seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) :
Lemma (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x) == x)
[SMTPat (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x) | val seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) :
Lemma (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x) == x)
[SMTPat (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x))]
let seq_nat8_to_seq_uint8_to_seq_nat8 (x: seq UInt8.t) = | false | null | true | assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8",
"Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8",
"Prims.unit"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
() | false | false | Vale.Def.Words.Seq.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 seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) :
Lemma (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x) == x)
[SMTPat (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x))] | [] | Vale.Def.Words.Seq.seq_nat8_to_seq_uint8_to_seq_nat8 | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8 x) ==
x)
[
SMTPat (Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8
x))
] | {
"end_col": 68,
"end_line": 167,
"start_col": 2,
"start_line": 167
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a | val seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
let seq_four_to_seq_LE_injective_specific (#a: eqtype) (x x': seq (four a))
: Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') = | false | null | true | seq_four_to_seq_LE_injective a | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq.seq_four_to_seq_LE_injective",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_imp",
"Prims.eq2",
"Prims.l_or",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Mul.op_Star",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') | [] | Vale.Def.Words.Seq.seq_four_to_seq_LE_injective_specific | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a) -> x': FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_LE x == Vale.Def.Words.Seq_s.seq_four_to_seq_LE x' ==>
x == x') | {
"end_col": 32,
"end_line": 196,
"start_col": 2,
"start_line": 196
} |
FStar.Pervasives.Lemma | val four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
() | val four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
let four_to_seq_to_four_BE (#a: Type) (x: seq4 a) : Lemma (four_to_seq_BE (seq_to_four_BE x) == x) = | false | null | true | assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words.Seq_s.seq4",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.four_to_seq_BE",
"Vale.Def.Words.Seq_s.seq_to_four_BE",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x) | false | false | Vale.Def.Words.Seq.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 four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x) | [] | Vale.Def.Words.Seq.four_to_seq_to_four_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words.Seq_s.seq4 a
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Words.Seq_s.four_to_seq_BE (Vale.Def.Words.Seq_s.seq_to_four_BE x) == x) | {
"end_col": 4,
"end_line": 121,
"start_col": 2,
"start_line": 120
} |
FStar.Pervasives.Lemma | val seq_nat8_to_seq_uint8_injective (b b':seq nat8) : Lemma
(requires equal (seq_nat8_to_seq_uint8 b) (seq_nat8_to_seq_uint8 b'))
(ensures b == b') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b' | val seq_nat8_to_seq_uint8_injective (b b':seq nat8) : Lemma
(requires equal (seq_nat8_to_seq_uint8 b) (seq_nat8_to_seq_uint8 b'))
(ensures b == b')
let seq_nat8_to_seq_uint8_injective b b' = | false | null | true | seq_map_injective UInt8.uint_to_t b b' | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat8",
"Vale.Lib.Seqs.seq_map_injective",
"FStar.UInt8.t",
"FStar.UInt8.uint_to_t",
"Prims.unit"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x) | false | false | Vale.Def.Words.Seq.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 seq_nat8_to_seq_uint8_injective (b b':seq nat8) : Lemma
(requires equal (seq_nat8_to_seq_uint8 b) (seq_nat8_to_seq_uint8 b'))
(ensures b == b') | [] | Vale.Def.Words.Seq.seq_nat8_to_seq_uint8_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.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.Words_s.nat8 -> b': FStar.Seq.Base.seq Vale.Def.Words_s.nat8
-> FStar.Pervasives.Lemma
(requires
FStar.Seq.Base.equal (Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 b)
(Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 b')) (ensures b == b') | {
"end_col": 40,
"end_line": 173,
"start_col": 2,
"start_line": 173
} |
FStar.Pervasives.Lemma | val seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) :
Lemma (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x) == x)
[SMTPat (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x) | val seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) :
Lemma (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x) == x)
[SMTPat (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x))]
let seq_uint8_to_seq_nat8_to_seq_uint8 (x: seq nat8) = | false | null | true | assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat8",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8",
"Prims.unit"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x) | false | false | Vale.Def.Words.Seq.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 seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) :
Lemma (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x) == x)
[SMTPat (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x))] | [] | Vale.Def.Words.Seq.seq_uint8_to_seq_nat8_to_seq_uint8 | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Words_s.nat8
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8 (Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 x) ==
x)
[
SMTPat (Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8 (Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8
x))
] | {
"end_col": 68,
"end_line": 170,
"start_col": 2,
"start_line": 170
} |
FStar.Pervasives.Lemma | val four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_LE x; four_to_seq_LE x'}
four_to_seq_LE x == four_to_seq_LE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a) | val four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_LE x; four_to_seq_LE x'}
four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
let four_to_seq_LE_injective (a: eqtype)
: Lemma (forall (x: four a) (x': four a). four_to_seq_LE x == four_to_seq_LE x' ==> x == x') = | false | null | true | generic_injective_proof #(four a)
#(seq4 a)
(four_to_seq_LE #a)
(seq_to_four_LE #a)
(seq_to_four_to_seq_LE #a) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"Vale.Lib.Meta.generic_injective_proof",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Vale.Def.Words.Seq.seq_to_four_to_seq_LE",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_LE x; four_to_seq_LE x'}
four_to_seq_LE x == four_to_seq_LE x' ==> x == x') | [] | Vale.Def.Words.Seq.four_to_seq_LE_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.eqtype
-> FStar.Pervasives.Lemma
(ensures
forall (x: Vale.Def.Words_s.four a) (x': Vale.Def.Words_s.four a).
{:pattern Vale.Def.Words.Seq_s.four_to_seq_LE x; Vale.Def.Words.Seq_s.four_to_seq_LE x'}
Vale.Def.Words.Seq_s.four_to_seq_LE x == Vale.Def.Words.Seq_s.four_to_seq_LE x' ==> x == x') | {
"end_col": 112,
"end_line": 206,
"start_col": 2,
"start_line": 206
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a | val seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
let seq_four_to_seq_BE_injective_specific (#a: eqtype) (x x': seq (four a))
: Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') = | false | null | true | seq_four_to_seq_BE_injective a | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq.seq_four_to_seq_BE_injective",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_imp",
"Prims.eq2",
"Prims.l_or",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Mul.op_Star",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') | [] | Vale.Def.Words.Seq.seq_four_to_seq_BE_injective_specific | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a) -> x': FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_BE x == Vale.Def.Words.Seq_s.seq_four_to_seq_BE x' ==>
x == x') | {
"end_col": 32,
"end_line": 201,
"start_col": 2,
"start_line": 201
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_BE x; seq_four_to_seq_BE x'}
seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
() | val seq_four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_BE x; seq_four_to_seq_BE x'}
seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
let seq_four_to_seq_BE_injective (a: eqtype)
: Lemma
(forall (x: seq (four a)) (x': seq (four a)).
seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x') = | false | null | true | let seq_four_to_seq_BE_stronger (#b: Type) (x: seq (four b)) : (s: seq b {length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger)
(seq_to_seq_four_BE #a)
(seq_to_seq_four_to_seq_BE #a);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"Prims.unit",
"Vale.Lib.Meta.generic_injective_proof",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"Vale.Def.Words.Seq.seq_to_seq_four_to_seq_BE",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_or",
"FStar.Mul.op_Star",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) : | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_BE x; seq_four_to_seq_BE x'}
seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x') | [] | Vale.Def.Words.Seq.seq_four_to_seq_BE_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.eqtype
-> FStar.Pervasives.Lemma
(ensures
forall (x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a))
(x': FStar.Seq.Base.seq (Vale.Def.Words_s.four a)).
{:pattern
Vale.Def.Words.Seq_s.seq_four_to_seq_BE x; Vale.Def.Words.Seq_s.seq_four_to_seq_BE x'}
Vale.Def.Words.Seq_s.seq_four_to_seq_BE x == Vale.Def.Words.Seq_s.seq_four_to_seq_BE x' ==>
x == x') | {
"end_col": 4,
"end_line": 191,
"start_col": 3,
"start_line": 186
} |
FStar.Pervasives.Lemma | val four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x)) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
() | val four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
let four_to_seq_LE_is_seq_four_to_seq_LE (#a: Type) (x: four a)
: Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x)) = | false | null | true | reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words_s.four",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Multiply",
"FStar.Seq.Base.create",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"FStar.Pervasives.reveal_opaque",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.nat",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x)) | false | false | Vale.Def.Words.Seq.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 four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x)) | [] | Vale.Def.Words.Seq.four_to_seq_LE_is_seq_four_to_seq_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.four a
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.four_to_seq_LE x ==
Vale.Def.Words.Seq_s.seq_four_to_seq_LE (FStar.Seq.Base.create 1 x)) | {
"end_col": 4,
"end_line": 135,
"start_col": 2,
"start_line": 131
} |
FStar.Pervasives.Lemma | val four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_BE x; four_to_seq_BE x'}
four_to_seq_BE x == four_to_seq_BE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a) | val four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_BE x; four_to_seq_BE x'}
four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
let four_to_seq_BE_injective (a: eqtype)
: Lemma (forall (x: four a) (x': four a). four_to_seq_BE x == four_to_seq_BE x' ==> x == x') = | false | null | true | generic_injective_proof #(four a)
#(seq4 a)
(four_to_seq_BE #a)
(seq_to_four_BE #a)
(seq_to_four_to_seq_BE #a) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"Vale.Lib.Meta.generic_injective_proof",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Words.Seq_s.four_to_seq_BE",
"Vale.Def.Words.Seq_s.seq_to_four_BE",
"Vale.Def.Words.Seq.seq_to_four_to_seq_BE",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 four_to_seq_BE_injective (a:eqtype) : Lemma
(forall (x x':four a).{:pattern four_to_seq_BE x; four_to_seq_BE x'}
four_to_seq_BE x == four_to_seq_BE x' ==> x == x') | [] | Vale.Def.Words.Seq.four_to_seq_BE_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.eqtype
-> FStar.Pervasives.Lemma
(ensures
forall (x: Vale.Def.Words_s.four a) (x': Vale.Def.Words_s.four a).
{:pattern Vale.Def.Words.Seq_s.four_to_seq_BE x; Vale.Def.Words.Seq_s.four_to_seq_BE x'}
Vale.Def.Words.Seq_s.four_to_seq_BE x == Vale.Def.Words.Seq_s.four_to_seq_BE x' ==> x == x') | {
"end_col": 112,
"end_line": 211,
"start_col": 2,
"start_line": 211
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
[SMTPat (seq_four_to_seq_BE (seq_to_seq_four_BE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
() | val seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
[SMTPat (seq_four_to_seq_BE (seq_to_seq_four_BE x))]
let seq_four_to_seq_to_seq_four_BE (#a: Type) (x: seq a {length x % 4 == 0})
: Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x) = | false | null | true | reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"FStar.Pervasives.reveal_opaque",
"Vale.Def.Words_s.four",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x) | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
[SMTPat (seq_four_to_seq_BE (seq_to_seq_four_BE x))] | [] | Vale.Def.Words.Seq.seq_four_to_seq_to_seq_four_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq a {FStar.Seq.Base.length x % 4 == 0}
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_BE (Vale.Def.Words.Seq_s.seq_to_seq_four_BE x) == x)
[SMTPat (Vale.Def.Words.Seq_s.seq_four_to_seq_BE (Vale.Def.Words.Seq_s.seq_to_seq_four_BE x))] | {
"end_col": 4,
"end_line": 51,
"start_col": 2,
"start_line": 48
} |
FStar.Pervasives.Lemma | val four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
() | val four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
let four_to_seq_to_four_LE (#a: Type) (x: seq4 a) : Lemma (four_to_seq_LE (seq_to_four_LE x) == x) = | false | null | true | assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words.Seq_s.seq4",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x) | false | false | Vale.Def.Words.Seq.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 four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x) | [] | Vale.Def.Words.Seq.four_to_seq_to_four_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words.Seq_s.seq4 a
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Words.Seq_s.four_to_seq_LE (Vale.Def.Words.Seq_s.seq_to_four_LE x) == x) | {
"end_col": 4,
"end_line": 110,
"start_col": 2,
"start_line": 109
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
[SMTPat (seq_four_to_seq_LE (seq_to_seq_four_LE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
() | val seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
[SMTPat (seq_four_to_seq_LE (seq_to_seq_four_LE x))]
let seq_four_to_seq_to_seq_four_LE (#a: Type) (x: seq a {length x % 4 == 0})
: Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x) = | false | null | true | reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"FStar.Pervasives.reveal_opaque",
"Vale.Def.Words_s.four",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x) | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
[SMTPat (seq_four_to_seq_LE (seq_to_seq_four_LE x))] | [] | Vale.Def.Words.Seq.seq_four_to_seq_to_seq_four_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq a {FStar.Seq.Base.length x % 4 == 0}
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_LE (Vale.Def.Words.Seq_s.seq_to_seq_four_LE x) == x)
[SMTPat (Vale.Def.Words.Seq_s.seq_four_to_seq_LE (Vale.Def.Words.Seq_s.seq_to_seq_four_LE x))] | {
"end_col": 4,
"end_line": 43,
"start_col": 2,
"start_line": 40
} |
FStar.Pervasives.Lemma | val seq_four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_LE x; seq_four_to_seq_LE x'}
seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
() | val seq_four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_LE x; seq_four_to_seq_LE x'}
seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
let seq_four_to_seq_LE_injective (a: eqtype)
: Lemma
(forall (x: seq (four a)) (x': seq (four a)).
seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x') = | false | null | true | let seq_four_to_seq_LE_stronger (#b: Type) (x: seq (four b)) : (s: seq b {length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger)
(seq_to_seq_four_LE #a)
(seq_to_seq_four_to_seq_LE #a);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.eqtype",
"Prims.unit",
"Vale.Lib.Meta.generic_injective_proof",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"Vale.Def.Words.Seq.seq_to_seq_four_to_seq_LE",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_or",
"FStar.Mul.op_Star",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) : | false | false | Vale.Def.Words.Seq.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 seq_four_to_seq_LE_injective (a:eqtype) : Lemma
(forall (x x':seq (four a)).{:pattern seq_four_to_seq_LE x; seq_four_to_seq_LE x'}
seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x') | [] | Vale.Def.Words.Seq.seq_four_to_seq_LE_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.eqtype
-> FStar.Pervasives.Lemma
(ensures
forall (x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a))
(x': FStar.Seq.Base.seq (Vale.Def.Words_s.four a)).
{:pattern
Vale.Def.Words.Seq_s.seq_four_to_seq_LE x; Vale.Def.Words.Seq_s.seq_four_to_seq_LE x'}
Vale.Def.Words.Seq_s.seq_four_to_seq_LE x == Vale.Def.Words.Seq_s.seq_four_to_seq_LE x' ==>
x == x') | {
"end_col": 4,
"end_line": 182,
"start_col": 3,
"start_line": 177
} |
FStar.Pervasives.Lemma | val four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x)) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
() | val four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
let four_to_seq_BE_is_seq_four_to_seq_BE (x: four nat32)
: Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x)) = | false | null | true | reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words_s.four",
"Vale.Def.Words_s.nat32",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Multiply",
"FStar.Seq.Base.create",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"Vale.Def.Words.Seq_s.seq4",
"Vale.Def.Words.Seq_s.four_to_seq_BE",
"FStar.Pervasives.reveal_opaque",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.nat",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x)) | false | false | Vale.Def.Words.Seq.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 four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x)) | [] | Vale.Def.Words.Seq.four_to_seq_BE_is_seq_four_to_seq_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.four Vale.Def.Words_s.nat32
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.four_to_seq_BE x ==
Vale.Def.Words.Seq_s.seq_four_to_seq_BE (FStar.Seq.Base.create 1 x)) | {
"end_col": 4,
"end_line": 144,
"start_col": 2,
"start_line": 140
} |
FStar.Pervasives.Lemma | val append_distributes_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_LE (x @| y) == seq_four_to_seq_LE x @| seq_four_to_seq_LE y) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 append_distributes_seq_four_to_seq_LE #a x y =
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
assert (equal (seq_four_to_seq_LE (x @| y)) (seq_four_to_seq_LE x @| seq_four_to_seq_LE y)) | val append_distributes_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_LE (x @| y) == seq_four_to_seq_LE x @| seq_four_to_seq_LE y)
let append_distributes_seq_four_to_seq_LE #a x y = | false | null | true | reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
assert (equal (seq_four_to_seq_LE (x @| y)) (seq_four_to_seq_LE x @| seq_four_to_seq_LE y)) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"FStar.Seq.Base.op_At_Bar",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Mul.op_Star"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat
let nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
=
generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8
(*
let seq_to_four_LE_injective () :
Lemma (forall (#a:Type) (x x':seq4 a) . seq_to_four_LE x == seq_to_four_LE x' ==> x == x')
=
generic_injective_proof seq_to_four_LE four_to_seq_LE four_to_seq_to_four_LE
*)
let append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y)
=
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_to_seq_four_LE (x @| y)) (seq_to_seq_four_LE x @| seq_to_seq_four_LE y));
()
let append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y)
=
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (x @| y)) (seq_to_seq_four_BE x @| seq_to_seq_four_BE y));
() | false | false | Vale.Def.Words.Seq.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 append_distributes_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_LE (x @| y) == seq_four_to_seq_LE x @| seq_four_to_seq_LE y) | [] | Vale.Def.Words.Seq.append_distributes_seq_four_to_seq_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a) -> y: FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_LE (x @| y) ==
Vale.Def.Words.Seq_s.seq_four_to_seq_LE x @| Vale.Def.Words.Seq_s.seq_four_to_seq_LE y) | {
"end_col": 93,
"end_line": 246,
"start_col": 2,
"start_line": 245
} |
FStar.Pervasives.Lemma | val seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
() | val seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x))]
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x: seq nat32)
: Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x) = | false | null | true | assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat32",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_BE",
"Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x) | false | false | Vale.Def.Words.Seq.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 seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x))] | [] | Vale.Def.Words.Seq.seq_nat8_to_seq_nat32_to_seq_nat8_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Words_s.nat32
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_BE (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE
x) ==
x)
[
SMTPat (Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_BE (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE
x))
] | {
"end_col": 4,
"end_line": 156,
"start_col": 2,
"start_line": 155
} |
FStar.Pervasives.Lemma | val append_distributes_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_BE (x @| y) == seq_four_to_seq_BE x @| seq_four_to_seq_BE y) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 append_distributes_seq_four_to_seq_BE #a x y =
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
assert (equal (seq_four_to_seq_BE (x @| y)) (seq_four_to_seq_BE x @| seq_four_to_seq_BE y)) | val append_distributes_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_BE (x @| y) == seq_four_to_seq_BE x @| seq_four_to_seq_BE y)
let append_distributes_seq_four_to_seq_BE #a x y = | false | null | true | reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
assert (equal (seq_four_to_seq_BE (x @| y)) (seq_four_to_seq_BE x @| seq_four_to_seq_BE y)) | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"FStar.Seq.Base.op_At_Bar",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Mul.op_Star"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat
let nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
=
generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8
(*
let seq_to_four_LE_injective () :
Lemma (forall (#a:Type) (x x':seq4 a) . seq_to_four_LE x == seq_to_four_LE x' ==> x == x')
=
generic_injective_proof seq_to_four_LE four_to_seq_LE four_to_seq_to_four_LE
*)
let append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y)
=
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_to_seq_four_LE (x @| y)) (seq_to_seq_four_LE x @| seq_to_seq_four_LE y));
()
let append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y)
=
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (x @| y)) (seq_to_seq_four_BE x @| seq_to_seq_four_BE y));
()
let append_distributes_seq_four_to_seq_LE #a x y =
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
assert (equal (seq_four_to_seq_LE (x @| y)) (seq_four_to_seq_LE x @| seq_four_to_seq_LE y)) | false | false | Vale.Def.Words.Seq.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 append_distributes_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) (y:seq (four a)) :
Lemma (seq_four_to_seq_BE (x @| y) == seq_four_to_seq_BE x @| seq_four_to_seq_BE y) | [] | Vale.Def.Words.Seq.append_distributes_seq_four_to_seq_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a) -> y: FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_four_to_seq_BE (x @| y) ==
Vale.Def.Words.Seq_s.seq_four_to_seq_BE x @| Vale.Def.Words.Seq_s.seq_four_to_seq_BE y) | {
"end_col": 93,
"end_line": 250,
"start_col": 2,
"start_line": 249
} |
FStar.Pervasives.Lemma | val four_to_nat_8_injective (_:unit) : Lemma
(forall (x x':four (natN (pow2_norm 8))).{:pattern four_to_nat 8 x; four_to_nat 8 x'}
four_to_nat 8 x == four_to_nat 8 x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat | val four_to_nat_8_injective (_:unit) : Lemma
(forall (x x':four (natN (pow2_norm 8))).{:pattern four_to_nat 8 x; four_to_nat 8 x'}
four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
let four_to_nat_8_injective ()
: Lemma
(forall (x: four (natN (pow2_norm 8))) (x': four (natN (pow2_norm 8))).
four_to_nat 8 x == four_to_nat 8 x' ==> x == x') = | false | null | true | generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.unit",
"Vale.Lib.Meta.generic_injective_proof",
"Vale.Def.Words_s.four",
"Vale.Def.Words_s.natN",
"Prims.pow2",
"FStar.Mul.op_Star",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Four_s.nat_to_four",
"Vale.Def.Words.Seq.nat_to_four_to_nat",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Vale.Def.Words_s.pow2_norm",
"Prims.l_imp",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 four_to_nat_8_injective (_:unit) : Lemma
(forall (x x':four (natN (pow2_norm 8))).{:pattern four_to_nat 8 x; four_to_nat 8 x'}
four_to_nat 8 x == four_to_nat 8 x' ==> x == x') | [] | Vale.Def.Words.Seq.four_to_nat_8_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures
forall (x: Vale.Def.Words_s.four (Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 8)))
(x': Vale.Def.Words_s.four (Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 8))).
{:pattern Vale.Def.Words.Four_s.four_to_nat 8 x; Vale.Def.Words.Four_s.four_to_nat 8 x'}
Vale.Def.Words.Four_s.four_to_nat 8 x == Vale.Def.Words.Four_s.four_to_nat 8 x' ==> x == x') | {
"end_col": 76,
"end_line": 216,
"start_col": 2,
"start_line": 216
} |
FStar.Pervasives.Lemma | val seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
() | val seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x))]
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x: seq nat32)
: Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x) = | false | null | true | assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat32",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE",
"Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x) | false | false | Vale.Def.Words.Seq.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 seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
[SMTPat (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x))] | [] | Vale.Def.Words.Seq.seq_nat8_to_seq_nat32_to_seq_nat8_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Words_s.nat32
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE
x) ==
x)
[
SMTPat (Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE
x))
] | {
"end_col": 4,
"end_line": 150,
"start_col": 2,
"start_line": 149
} |
FStar.Pervasives.Lemma | val seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
[SMTPat (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
() | val seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
[SMTPat (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x))]
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x: seq nat8 {length x % 4 == 0})
: Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x) = | false | null | true | reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat8",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE",
"FStar.Pervasives.reveal_opaque",
"Vale.Def.Words_s.four",
"Prims.op_Division",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"FStar.Mul.op_Star",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x) | false | false | Vale.Def.Words.Seq.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 seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
[SMTPat (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x))] | [] | Vale.Def.Words.Seq.seq_nat32_to_seq_nat8_to_seq_nat32_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Words_s.nat8 {FStar.Seq.Base.length x % 4 == 0}
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE (Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE
x) ==
x)
[
SMTPat (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE (Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE
x))
] | {
"end_col": 4,
"end_line": 164,
"start_col": 2,
"start_line": 161
} |
FStar.Pervasives.Lemma | val seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
() | val seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
let seq_to_seq_four_to_seq_BE (#a: Type) (x: seq (four a))
: Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))] = | false | null | true | reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"Vale.Def.Words.Seq_s.seq_four_to_seq_BE",
"FStar.Pervasives.reveal_opaque",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))] | false | false | Vale.Def.Words.Seq.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 seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))] | [] | Vale.Def.Words.Seq.seq_to_seq_four_to_seq_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_to_seq_four_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE x) == x)
[SMTPat (Vale.Def.Words.Seq_s.seq_to_seq_four_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE x))] | {
"end_col": 4,
"end_line": 35,
"start_col": 2,
"start_line": 32
} |
FStar.Pervasives.Lemma | val nat_to_four_8_injective (_:unit) : Lemma
(forall (x x':natN (pow2_norm 32)).{:pattern nat_to_four 8 x; nat_to_four 8 x'}
nat_to_four 8 x == nat_to_four 8 x' ==> x == x') | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
=
generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8 | val nat_to_four_8_injective (_:unit) : Lemma
(forall (x x':natN (pow2_norm 32)).{:pattern nat_to_four 8 x; nat_to_four 8 x'}
nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
let nat_to_four_8_injective ()
: Lemma
(forall (x: natN (pow2_norm 32)) (x': natN (pow2_norm 32)).
nat_to_four 8 x == nat_to_four 8 x' ==> x == x') = | false | null | true | generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8 | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Prims.unit",
"Vale.Lib.Meta.generic_injective_proof",
"Vale.Def.Words_s.natN",
"Prims.pow2",
"FStar.Mul.op_Star",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Four_s.nat_to_four",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq.four_to_nat_to_four_8",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Vale.Def.Words_s.pow2_norm",
"Prims.l_imp",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat
let nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x') | false | false | Vale.Def.Words.Seq.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 nat_to_four_8_injective (_:unit) : Lemma
(forall (x x':natN (pow2_norm 32)).{:pattern nat_to_four 8 x; nat_to_four 8 x'}
nat_to_four 8 x == nat_to_four 8 x' ==> x == x') | [] | Vale.Def.Words.Seq.nat_to_four_8_injective | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures
forall (x: Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 32))
(x': Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 32)).
{:pattern Vale.Def.Words.Four_s.nat_to_four 8 x; Vale.Def.Words.Four_s.nat_to_four 8 x'}
Vale.Def.Words.Four_s.nat_to_four 8 x == Vale.Def.Words.Four_s.nat_to_four 8 x' ==> x == x') | {
"end_col": 79,
"end_line": 221,
"start_col": 2,
"start_line": 221
} |
FStar.Pervasives.Lemma | val seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
() | val seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
let seq_to_seq_four_to_seq_LE (#a: Type) (x: seq (four a))
: Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))] = | false | null | true | reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.four",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Division",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"Prims.op_Multiply",
"Vale.Def.Words.Seq_s.seq_four_to_seq_LE",
"FStar.Pervasives.reveal_opaque",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Prims.l_True",
"Prims.squash",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))] | false | false | Vale.Def.Words.Seq.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 seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))] | [] | Vale.Def.Words.Seq.seq_to_seq_four_to_seq_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq (Vale.Def.Words_s.four a)
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_to_seq_four_LE (Vale.Def.Words.Seq_s.seq_four_to_seq_LE x) == x)
[SMTPat (Vale.Def.Words.Seq_s.seq_to_seq_four_LE (Vale.Def.Words.Seq_s.seq_four_to_seq_LE x))] | {
"end_col": 4,
"end_line": 26,
"start_col": 2,
"start_line": 21
} |
FStar.Pervasives.Lemma | val append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y)
=
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (x @| y)) (seq_to_seq_four_BE x @| seq_to_seq_four_BE y));
() | val append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y)
let append_distributes_seq_to_seq_four_BE
(#a: Type)
(x: seq a {length x % 4 == 0})
(y: seq a {length y % 4 == 0})
: Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y) = | false | null | true | reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (x @| y)) (seq_to_seq_four_BE x @| seq_to_seq_four_BE y));
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq_s.seq_to_seq_four_BE",
"FStar.Seq.Base.op_At_Bar",
"FStar.Pervasives.reveal_opaque",
"Prims.op_Division",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat
let nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
=
generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8
(*
let seq_to_four_LE_injective () :
Lemma (forall (#a:Type) (x x':seq4 a) . seq_to_four_LE x == seq_to_four_LE x' ==> x == x')
=
generic_injective_proof seq_to_four_LE four_to_seq_LE four_to_seq_to_four_LE
*)
let append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y)
=
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_to_seq_four_LE (x @| y)) (seq_to_seq_four_LE x @| seq_to_seq_four_LE y));
()
let append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y) | false | false | Vale.Def.Words.Seq.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 append_distributes_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_BE (x @| y) == seq_to_seq_four_BE x @| seq_to_seq_four_BE y) | [] | Vale.Def.Words.Seq.append_distributes_seq_to_seq_four_BE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
x: FStar.Seq.Base.seq a {FStar.Seq.Base.length x % 4 == 0} ->
y: FStar.Seq.Base.seq a {FStar.Seq.Base.length y % 4 == 0}
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_to_seq_four_BE (x @| y) ==
Vale.Def.Words.Seq_s.seq_to_seq_four_BE x @| Vale.Def.Words.Seq_s.seq_to_seq_four_BE y) | {
"end_col": 4,
"end_line": 242,
"start_col": 2,
"start_line": 240
} |
FStar.Pervasives.Lemma | val append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y) | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y)
=
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_to_seq_four_LE (x @| y)) (seq_to_seq_four_LE x @| seq_to_seq_four_LE y));
() | val append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y)
let append_distributes_seq_to_seq_four_LE
(#a: Type)
(x: seq a {length x % 4 == 0})
(y: seq a {length y % 4 == 0})
: Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y) = | false | null | true | reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_to_seq_four_LE (x @| y)) (seq_to_seq_four_LE x @| seq_to_seq_four_LE y));
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Seq_s.seq_to_seq_four_LE",
"FStar.Seq.Base.op_At_Bar",
"FStar.Pervasives.reveal_opaque",
"Prims.op_Division",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
()
#reset-options
let four_to_seq_to_four_LE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_LE (seq_to_four_LE x) == x)
=
assert (equal (four_to_seq_LE (seq_to_four_LE x)) x);
()
let seq_to_four_to_seq_LE (#a:Type) (x:four a) :
Lemma (seq_to_four_LE (four_to_seq_LE x) == x)
=
()
let four_to_seq_to_four_BE (#a:Type) (x:seq4 a) :
Lemma (four_to_seq_BE (seq_to_four_BE x) == x)
=
assert (equal (four_to_seq_BE (seq_to_four_BE x)) x);
()
let seq_to_four_to_seq_BE (#a:Type) (x:four a) :
Lemma (seq_to_four_BE (four_to_seq_BE x) == x)
=
()
let four_to_seq_LE_is_seq_four_to_seq_LE(#a:Type) (x:four a) :
Lemma (four_to_seq_LE x == seq_four_to_seq_LE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
let s0 = four_to_seq_LE x in
let s1 = seq_four_to_seq_LE (create 1 x) in
assert (equal s0 s1);
()
let four_to_seq_BE_is_seq_four_to_seq_BE (x:four nat32) :
Lemma (four_to_seq_BE x == seq_four_to_seq_BE (create 1 x))
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32);
let s0 = four_to_seq_BE x in
let s1 = seq_four_to_seq_BE (create 1 x) in
assert (equal s0 s1);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_LE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE x)) x);
()
let seq_nat8_to_seq_nat32_to_seq_nat8_BE (x:seq nat32) :
Lemma (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x) == x)
=
assert (equal (seq_nat8_to_seq_nat32_BE (seq_nat32_to_seq_nat8_BE x)) x);
()
let seq_nat32_to_seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) :
Lemma (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (equal (seq_nat32_to_seq_nat8_LE (seq_nat8_to_seq_nat32_LE x)) x);
()
let seq_nat8_to_seq_uint8_to_seq_nat8 (x:seq UInt8.t) =
assert (equal (seq_nat8_to_seq_uint8 (seq_uint8_to_seq_nat8 x)) x)
let seq_uint8_to_seq_nat8_to_seq_uint8 (x:seq nat8) =
assert (equal (seq_uint8_to_seq_nat8 (seq_nat8_to_seq_uint8 x)) x)
let seq_nat8_to_seq_uint8_injective b b' =
seq_map_injective UInt8.uint_to_t b b'
let seq_four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_LE #a x == seq_four_to_seq_LE #a x' ==> x == x')
=
let seq_four_to_seq_LE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_LE x
in
generic_injective_proof (seq_four_to_seq_LE_stronger) (seq_to_seq_four_LE #a) (seq_to_seq_four_to_seq_LE #a);
()
let seq_four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': seq (four a)). seq_four_to_seq_BE #a x == seq_four_to_seq_BE #a x' ==> x == x')
=
let seq_four_to_seq_BE_stronger (#b:Type) (x:seq (four b)) : (s:seq b{length s % 4 == 0}) =
seq_four_to_seq_BE x
in
generic_injective_proof (seq_four_to_seq_BE_stronger) (seq_to_seq_four_BE #a) (seq_to_seq_four_to_seq_BE #a);
()
let seq_four_to_seq_LE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_LE x == seq_four_to_seq_LE x' ==> x == x')
=
seq_four_to_seq_LE_injective a
let seq_four_to_seq_BE_injective_specific (#a:eqtype) (x x':seq (four a)) :
Lemma (seq_four_to_seq_BE x == seq_four_to_seq_BE x' ==> x == x')
=
seq_four_to_seq_BE_injective a
let four_to_seq_LE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_LE x == four_to_seq_LE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_LE #a) (seq_to_four_LE #a) (seq_to_four_to_seq_LE #a)
let four_to_seq_BE_injective (a:eqtype) :
Lemma (forall (x x': four a) . four_to_seq_BE x == four_to_seq_BE x' ==> x == x')
=
generic_injective_proof #(four a) #(seq4 a) (four_to_seq_BE #a) (seq_to_four_BE #a) (seq_to_four_to_seq_BE #a)
let four_to_nat_8_injective () :
Lemma (forall (x x':four (natN (pow2_norm 8))) . four_to_nat 8 x == four_to_nat 8 x' ==> x == x')
=
generic_injective_proof (four_to_nat 8) (nat_to_four 8) nat_to_four_to_nat
let nat_to_four_8_injective () :
Lemma (forall (x x':natN (pow2_norm 32)) . nat_to_four 8 x == nat_to_four 8 x' ==> x == x')
=
generic_injective_proof (nat_to_four 8) (four_to_nat 8) four_to_nat_to_four_8
(*
let seq_to_four_LE_injective () :
Lemma (forall (#a:Type) (x x':seq4 a) . seq_to_four_LE x == seq_to_four_LE x' ==> x == x')
=
generic_injective_proof seq_to_four_LE four_to_seq_LE four_to_seq_to_four_LE
*)
let append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y) | false | false | Vale.Def.Words.Seq.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 append_distributes_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) (y:seq a{length y % 4 == 0}) :
Lemma (seq_to_seq_four_LE (x @| y) == seq_to_seq_four_LE x @| seq_to_seq_four_LE y) | [] | Vale.Def.Words.Seq.append_distributes_seq_to_seq_four_LE | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
x: FStar.Seq.Base.seq a {FStar.Seq.Base.length x % 4 == 0} ->
y: FStar.Seq.Base.seq a {FStar.Seq.Base.length y % 4 == 0}
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Words.Seq_s.seq_to_seq_four_LE (x @| y) ==
Vale.Def.Words.Seq_s.seq_to_seq_four_LE x @| Vale.Def.Words.Seq_s.seq_to_seq_four_LE y) | {
"end_col": 4,
"end_line": 235,
"start_col": 2,
"start_line": 233
} |
FStar.Pervasives.Lemma | val four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
() | val four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
let four_to_nat_to_four_8 (x: natN (pow2_norm 32))
: Lemma (four_to_nat 8 (nat_to_four 8 x) == x) [SMTPat (four_to_nat 8 (nat_to_four 8 x))] = | false | null | true | let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.pow2_norm",
"Prims.pow2",
"Prims.unit",
"Vale.Def.Words.Seq.lemma_fundamental_div_mod_4",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.nat",
"Prims.l_or",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.int",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words_s.int_to_natN",
"Vale.Def.Words_s.four",
"Vale.Def.Words.Four_s.nat_to_four",
"Vale.Def.Words_s.Mkfour",
"Prims.op_Modulus",
"Prims.op_Division",
"Prims.pos",
"Prims.l_True",
"Prims.squash",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x) | false | false | Vale.Def.Words.Seq.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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))] | [] | Vale.Def.Words.Seq.four_to_nat_to_four_8 | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 32)
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Four_s.nat_to_four 8 x) == x)
[SMTPat (Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Four_s.nat_to_four 8 x))] | {
"end_col": 4,
"end_line": 81,
"start_col": 3,
"start_line": 65
} |
FStar.Pervasives.Lemma | val nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))] | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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_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.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_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words",
"short_module": null
},
{
"abbrev": 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 nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1));
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
() | val nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))]
let nat_to_four_to_nat (x: four (natN (pow2_norm 8)))
: Lemma (nat_to_four 8 (four_to_nat 8 x) == x) [SMTPat (nat_to_four 8 (four_to_nat 8 x))] = | false | null | true | let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let x' = four_to_nat 8 x in
assert_norm (nat_to_four 8 x' == Mkfour (x' % n1) ((x' / n1) % n1) ((x' / n2) % n1) ((x' / n3) % n1)
);
let Mkfour x0 x1 x2 x3 = x in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 x == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x';
() | {
"checked_file": "Vale.Def.Words.Seq.fst.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Def.Words.Seq.fst"
} | [
"lemma"
] | [
"Vale.Def.Words_s.four",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.pow2_norm",
"Prims.unit",
"Vale.Def.Words.Seq.lemma_fundamental_div_mod_4",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.nat",
"Prims.l_or",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.int",
"Prims.pow2",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words_s.int_to_natN",
"FStar.Pervasives.normalize_term",
"Prims.pos",
"Vale.Def.Words.Four_s.nat_to_four",
"Vale.Def.Words_s.Mkfour",
"Prims.op_Modulus",
"Prims.op_Division",
"Prims.op_Multiply",
"Prims.l_True",
"Prims.squash",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module Vale.Def.Words.Seq
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Words.Seq_s
open FStar.Mul
open Vale.Lib.Meta
open Vale.Lib.Seqs_s
open Vale.Lib.Seqs
let two_to_seq_to_two_LE #a x =
assert (equal (two_to_seq_LE (seq_to_two_LE x)) x)
let seq_to_two_to_seq_LE #a x = ()
let seq_to_seq_four_to_seq_LE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_LE (seq_four_to_seq_LE x) == x)
[SMTPat (seq_to_seq_four_LE (seq_four_to_seq_LE x))]
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
let bytes = seq_four_to_seq_LE x in
let fours = seq_to_seq_four_LE bytes in
assert (equal fours x);
()
let seq_to_seq_four_to_seq_BE (#a:Type) (x:seq (four a)) :
Lemma (seq_to_seq_four_BE (seq_four_to_seq_BE x) == x)
[SMTPat (seq_to_seq_four_BE (seq_four_to_seq_BE x))]
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_to_seq_four_BE (seq_four_to_seq_BE x)) x);
()
let seq_four_to_seq_to_seq_four_LE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_LE (seq_to_seq_four_LE x) == x)
=
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #a);
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #a);
assert (equal (seq_four_to_seq_LE (seq_to_seq_four_LE x)) x);
()
let seq_four_to_seq_to_seq_four_BE (#a:Type) (x:seq a{length x % 4 == 0}) :
Lemma (seq_four_to_seq_BE (seq_to_seq_four_BE x) == x)
=
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #a);
reveal_opaque (`%seq_to_seq_four_BE) (seq_to_seq_four_BE #a);
assert (equal (seq_four_to_seq_BE (seq_to_seq_four_BE x)) x);
()
unfold let pow2_24 = 16777216 //normalize_term (pow2 24)
#reset-options "--z3rlimit 200 --using_facts_from 'Prims Vale.Def.Words_s'"
let lemma_fundamental_div_mod_4 (x:nat32) :
Lemma (x = x % pow2_8 + pow2_8 * ((x / pow2_8) % pow2_8) + pow2_16 * ((x / pow2_16) % pow2_8) + pow2_24 * ((x / pow2_24) % pow2_8))
=
()
#reset-options "--z3rlimit 30"
let four_to_nat_to_four_8 (x:natN (pow2_norm 32)) :
Lemma (four_to_nat 8 (nat_to_four 8 x) == x)
[SMTPat (four_to_nat 8 (nat_to_four 8 x))]
=
let size = 8 in
let n1 = pow2_norm size in
let n2 = pow2_norm (2 * size) in
let n3 = pow2_norm (3 * size) in
let n4 = pow2_norm (4 * size) in
assert_norm (pow2 8 == 256);
assert_norm (pow2 16 == 0x10000);
assert_norm (pow2 24 == 0x1000000);
assert_norm (pow2 32 == 0x100000000);
let fourX = nat_to_four 8 x in
assert_norm (nat_to_four 8 x == Mkfour (x % n1) ((x / n1) % n1) ((x / n2) % n1) ((x / n3) % n1));
let Mkfour x0 x1 x2 x3 = fourX in
let x' = x0 + x1 * n1 + x2 * n2 + x3 * n3 in
assert_norm (four_to_nat 8 fourX == int_to_natN n4 (x0 + x1 * n1 + x2 * n2 + x3 * n3));
lemma_fundamental_div_mod_4 x;
()
#reset-options "--z3rlimit 400 --using_facts_from 'Vale.Def.Words_s Prims'"
let nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x) | false | false | Vale.Def.Words.Seq.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": 400,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val nat_to_four_to_nat (x:four (natN (pow2_norm 8))) :
Lemma (nat_to_four 8 (four_to_nat 8 x) == x)
[SMTPat (nat_to_four 8 (four_to_nat 8 x))] | [] | Vale.Def.Words.Seq.nat_to_four_to_nat | {
"file_name": "vale/code/lib/util/Vale.Def.Words.Seq.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Def.Words_s.four (Vale.Def.Words_s.natN (Vale.Def.Words_s.pow2_norm 8))
-> FStar.Pervasives.Lemma
(ensures Vale.Def.Words.Four_s.nat_to_four 8 (Vale.Def.Words.Four_s.four_to_nat 8 x) == x)
[SMTPat (Vale.Def.Words.Four_s.nat_to_four 8 (Vale.Def.Words.Four_s.four_to_nat 8 x))] | {
"end_col": 4,
"end_line": 103,
"start_col": 3,
"start_line": 87
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 felem5 = uint64 & uint64 & uint64 & uint64 & uint64 | let felem5 = | false | null | false | uint64 & uint64 & uint64 & uint64 & uint64 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple5",
"Lib.IntTypes.uint64"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192 | false | true | Hacl.Spec.K256.Field52.Definitions.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 felem5 : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.felem5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 55,
"end_line": 21,
"start_col": 13,
"start_line": 21
} |
|
Prims.Tot | val mk_nat5 (x: nat) : nat5 | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 mk_nat5 (x:nat) : nat5 = (x,x,x,x,x) | val mk_nat5 (x: nat) : nat5
let mk_nat5 (x: nat) : nat5 = | false | null | false | (x, x, x, x, x) | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"Hacl.Spec.K256.Field52.Definitions.nat5"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536} | false | true | Hacl.Spec.K256.Field52.Definitions.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 mk_nat5 (x: nat) : nat5 | [] | Hacl.Spec.K256.Field52.Definitions.mk_nat5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Prims.nat -> Hacl.Spec.K256.Field52.Definitions.nat5 | {
"end_col": 40,
"end_line": 81,
"start_col": 29,
"start_line": 81
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 felem4 = uint64 & uint64 & uint64 & uint64 | let felem4 = | false | null | false | uint64 & uint64 & uint64 & uint64 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple4",
"Lib.IntTypes.uint64"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | false | true | Hacl.Spec.K256.Field52.Definitions.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 felem4 : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.felem4 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 46,
"end_line": 12,
"start_col": 13,
"start_line": 12
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 scale64 = x:nat{x <= 4096} | let scale64 = | false | null | false | x: nat{x <= 4096} | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime | false | true | Hacl.Spec.K256.Field52.Definitions.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 scale64 : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.scale64 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 78,
"start_col": 14,
"start_line": 78
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 nat5 = nat & nat & nat & nat & nat | let nat5 = | false | null | false | nat & nat & nat & nat & nat | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple5",
"Prims.nat"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096} | false | true | Hacl.Spec.K256.Field52.Definitions.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 nat5 : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.nat5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 38,
"end_line": 80,
"start_col": 11,
"start_line": 80
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 scale64_last = x:nat{x <= 65536} | let scale64_last = | false | null | false | x: nat{x <= 65536} | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime | false | true | Hacl.Spec.K256.Field52.Definitions.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 scale64_last : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.scale64_last | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 36,
"end_line": 79,
"start_col": 19,
"start_line": 79
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536} | let scale64_5 = | false | null | false | x:
nat5
{ let x0, x1, x2, x3, x4 = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536 } | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.nat5",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x) | false | true | Hacl.Spec.K256.Field52.Definitions.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 scale64_5 : Type0 | [] | Hacl.Spec.K256.Field52.Definitions.scale64_5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 70,
"end_line": 84,
"start_col": 16,
"start_line": 83
} |
|
Prims.Tot | val max52:pos | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 max52 : pos =
assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1 | val max52:pos
let max52:pos = | false | null | false | assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_GreaterThan"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4)
let ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4)
noextract | false | true | Hacl.Spec.K256.Field52.Definitions.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 max52:pos | [] | Hacl.Spec.K256.Field52.Definitions.max52 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.pos | {
"end_col": 13,
"end_line": 106,
"start_col": 2,
"start_line": 105
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 felem_fits1 (x:uint64) (m:scale64) =
v x <= m * max52 | let felem_fits1 (x: uint64) (m: scale64) = | false | null | false | v x <= m * max52 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint64",
"Hacl.Spec.K256.Field52.Definitions.scale64",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.max52",
"Prims.bool"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4)
let ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4)
noextract
let max52 : pos =
assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1
noextract
let max48 : pos =
assert_norm (pow2 48 - 1 > 0);
pow2 48 - 1 | false | true | Hacl.Spec.K256.Field52.Definitions.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 felem_fits1 : x: Lib.IntTypes.uint64 -> m: Hacl.Spec.K256.Field52.Definitions.scale64 -> Prims.bool | [] | Hacl.Spec.K256.Field52.Definitions.felem_fits1 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.uint64 -> m: Hacl.Spec.K256.Field52.Definitions.scale64 -> Prims.bool | {
"end_col": 18,
"end_line": 115,
"start_col": 2,
"start_line": 115
} |
|
Prims.Tot | val max48:pos | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 max48 : pos =
assert_norm (pow2 48 - 1 > 0);
pow2 48 - 1 | val max48:pos
let max48:pos = | false | null | false | assert_norm (pow2 48 - 1 > 0);
pow2 48 - 1 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_GreaterThan"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4)
let ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4)
noextract
let max52 : pos =
assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1
noextract | false | true | Hacl.Spec.K256.Field52.Definitions.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 max48:pos | [] | Hacl.Spec.K256.Field52.Definitions.max48 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.pos | {
"end_col": 13,
"end_line": 111,
"start_col": 2,
"start_line": 110
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192 | let as_nat4 (f: felem4) = | false | null | false | let f0, f1, f2, f3 = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.felem4",
"Lib.IntTypes.uint64",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.int"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64 | false | true | Hacl.Spec.K256.Field52.Definitions.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 as_nat4 : f: Hacl.Spec.K256.Field52.Definitions.felem4 -> Prims.int | [] | Hacl.Spec.K256.Field52.Definitions.as_nat4 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.K256.Field52.Definitions.felem4 -> Prims.int | {
"end_col": 59,
"end_line": 17,
"start_col": 24,
"start_line": 15
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 felem_fits_last1 (x:uint64) (m:scale64_last) =
v x <= m * max48 | let felem_fits_last1 (x: uint64) (m: scale64_last) = | false | null | false | v x <= m * max48 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint64",
"Hacl.Spec.K256.Field52.Definitions.scale64_last",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.max48",
"Prims.bool"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4)
let ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4)
noextract
let max52 : pos =
assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1
noextract
let max48 : pos =
assert_norm (pow2 48 - 1 > 0);
pow2 48 - 1
let felem_fits1 (x:uint64) (m:scale64) =
v x <= m * max52 | false | true | Hacl.Spec.K256.Field52.Definitions.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 felem_fits_last1 : x: Lib.IntTypes.uint64 -> m: Hacl.Spec.K256.Field52.Definitions.scale64_last -> Prims.bool | [] | Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.uint64 -> m: Hacl.Spec.K256.Field52.Definitions.scale64_last -> Prims.bool | {
"end_col": 18,
"end_line": 118,
"start_col": 2,
"start_line": 118
} |
|
Prims.Tot | val feval5 (f: felem5) : S.felem | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 feval5 (f:felem5) : S.felem = as_nat5 f % S.prime | val feval5 (f: felem5) : S.felem
let feval5 (f: felem5) : S.felem = | false | null | false | as_nat5 f % S.prime | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Prims.op_Modulus",
"Hacl.Spec.K256.Field52.Definitions.as_nat5",
"Spec.K256.PointOps.prime",
"Spec.K256.PointOps.felem"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 | false | true | Hacl.Spec.K256.Field52.Definitions.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 feval5 (f: felem5) : S.felem | [] | Hacl.Spec.K256.Field52.Definitions.feval5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.K256.Field52.Definitions.felem5 -> Spec.K256.PointOps.felem | {
"end_col": 53,
"end_line": 75,
"start_col": 34,
"start_line": 75
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 felem_fits5 (f:felem5) (m:scale64_5) =
let (f0,f1,f2,f3,f4) = f in
let (m0,m1,m2,m3,m4) = m in
felem_fits1 f0 m0 /\
felem_fits1 f1 m1 /\
felem_fits1 f2 m2 /\
felem_fits1 f3 m3 /\
felem_fits_last1 f4 m4 | let felem_fits5 (f: felem5) (m: scale64_5) = | false | null | false | let f0, f1, f2, f3, f4 = f in
let m0, m1, m2, m3, m4 = m in
felem_fits1 f0 m0 /\ felem_fits1 f1 m1 /\ felem_fits1 f2 m2 /\ felem_fits1 f3 m3 /\
felem_fits_last1 f4 m4 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Hacl.Spec.K256.Field52.Definitions.scale64_5",
"Lib.IntTypes.uint64",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Hacl.Spec.K256.Field52.Definitions.felem_fits1",
"Hacl.Spec.K256.Field52.Definitions.felem_fits_last1",
"Prims.logical"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4)
let ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4)
noextract
let max52 : pos =
assert_norm (pow2 52 - 1 > 0);
pow2 52 - 1
noextract
let max48 : pos =
assert_norm (pow2 48 - 1 > 0);
pow2 48 - 1
let felem_fits1 (x:uint64) (m:scale64) =
v x <= m * max52
let felem_fits_last1 (x:uint64) (m:scale64_last) =
v x <= m * max48 | false | true | Hacl.Spec.K256.Field52.Definitions.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 felem_fits5 : f: Hacl.Spec.K256.Field52.Definitions.felem5 -> m: Hacl.Spec.K256.Field52.Definitions.scale64_5
-> Prims.logical | [] | Hacl.Spec.K256.Field52.Definitions.felem_fits5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.K256.Field52.Definitions.felem5 -> m: Hacl.Spec.K256.Field52.Definitions.scale64_5
-> Prims.logical | {
"end_col": 24,
"end_line": 127,
"start_col": 42,
"start_line": 120
} |
|
Prims.Tot | val op_Plus_Star (x y: nat5) : nat5 | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4) | val op_Plus_Star (x y: nat5) : nat5
let op_Plus_Star (x y: nat5) : nat5 = | false | null | false | let x0, x1, x2, x3, x4 = x in
let y0, y1, y2, y3, y4 = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4) | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.nat5",
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"Prims.op_Addition"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4 | false | true | Hacl.Spec.K256.Field52.Definitions.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 op_Plus_Star (x y: nat5) : nat5 | [] | Hacl.Spec.K256.Field52.Definitions.op_Plus_Star | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.K256.Field52.Definitions.nat5 -> y: Hacl.Spec.K256.Field52.Definitions.nat5
-> Hacl.Spec.K256.Field52.Definitions.nat5 | {
"end_col": 47,
"end_line": 95,
"start_col": 30,
"start_line": 92
} |
Prims.Tot | val mask48:x: uint64{v x == pow2 48 - 1} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff | val mask48:x: uint64{v x == pow2 48 - 1}
let mask48:x: uint64{v x == pow2 48 - 1} = | false | null | false | assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Lib.IntTypes.u64",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract | false | false | Hacl.Spec.K256.Field52.Definitions.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 mask48:x: uint64{v x == pow2 48 - 1} | [] | Hacl.Spec.K256.Field52.Definitions.mask48 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC {Lib.IntTypes.v x == Prims.pow2 48 - 1} | {
"end_col": 20,
"end_line": 41,
"start_col": 2,
"start_line": 40
} |
Prims.Tot | val mask52:x: uint64{v x == pow2 52 - 1} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff | val mask52:x: uint64{v x == pow2 52 - 1}
let mask52:x: uint64{v x == pow2 52 - 1} = | false | null | false | assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Lib.IntTypes.u64",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract | false | false | Hacl.Spec.K256.Field52.Definitions.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 mask52:x: uint64{v x == pow2 52 - 1} | [] | Hacl.Spec.K256.Field52.Definitions.mask52 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC {Lib.IntTypes.v x == Prims.pow2 52 - 1} | {
"end_col": 21,
"end_line": 35,
"start_col": 2,
"start_line": 34
} |
Prims.Tot | val pow52:(pow52:
pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52 | val pow52:(pow52:
pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52})
let pow52:(pow52:
pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) = | false | null | false | let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = (16777216 * pow52) * pow52);
pow52 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.pow2",
"FStar.Mul.op_Star",
"Prims.pos",
"FStar.Pervasives.normalize_term"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64 | false | false | Hacl.Spec.K256.Field52.Definitions.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 pow52:(pow52:
pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) | [] | Hacl.Spec.K256.Field52.Definitions.pow52 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pow52:
Prims.pos
{ Prims.pow2 64 == 4096 * pow52 /\ Prims.pow2 128 == (16777216 * pow52) * pow52 /\
Prims.pow2 52 == pow52 } | {
"end_col": 7,
"end_line": 29,
"start_col": 109,
"start_line": 24
} |
Prims.Tot | val pow104:(pow104: pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104 | val pow104:(pow104: pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52})
let pow104:(pow104: pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) = | false | null | false | let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.pos",
"Prims.pow2",
"FStar.Pervasives.normalize_term"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff | false | false | Hacl.Spec.K256.Field52.Definitions.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 pow104:(pow104: pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) | [] | Hacl.Spec.K256.Field52.Definitions.pow104 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pow104:
Prims.pos
{ Prims.pow2 104 == pow104 /\
pow104 == Hacl.Spec.K256.Field52.Definitions.pow52 * Hacl.Spec.K256.Field52.Definitions.pow52 } | {
"end_col": 8,
"end_line": 49,
"start_col": 73,
"start_line": 45
} |
Prims.Tot | val as_nat5 (f: felem5) : nat | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 | val as_nat5 (f: felem5) : nat
let as_nat5 (f: felem5) : nat = | false | null | false | let f0, f1, f2, f3, f4 = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Lib.IntTypes.uint64",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.pow52",
"Hacl.Spec.K256.Field52.Definitions.pow104",
"Hacl.Spec.K256.Field52.Definitions.pow156",
"Hacl.Spec.K256.Field52.Definitions.pow208",
"Prims.nat"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208 | false | true | Hacl.Spec.K256.Field52.Definitions.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 as_nat5 (f: felem5) : nat | [] | Hacl.Spec.K256.Field52.Definitions.as_nat5 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.K256.Field52.Definitions.felem5 -> Prims.nat | {
"end_col": 69,
"end_line": 72,
"start_col": 30,
"start_line": 70
} |
Prims.Tot | val op_Star_Star (x y: nat5) : nat5 | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 ( ** ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4) | val op_Star_Star (x y: nat5) : nat5
let op_Star_Star (x y: nat5) : nat5 = | false | null | false | let x0, x1, x2, x3, x4 = x in
let y0, y1, y2, y3, y4 = y in
(x0 * y0, x1 * y1, x2 * y2, x3 * y3, x4 * y4) | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Hacl.Spec.K256.Field52.Definitions.nat5",
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"FStar.Mul.op_Star"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156
[@"opaque_to_smt"]
let pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208
noextract
let as_nat5 (f:felem5) : nat =
let (f0, f1, f2, f3, f4) = f in
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208
noextract
let feval5 (f:felem5) : S.felem = as_nat5 f % S.prime
let scale64 = x:nat{x <= 4096}
let scale64_last = x:nat{x <= 65536}
let nat5 = nat & nat & nat & nat & nat
let mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)
let scale64_5 = x:nat5{let (x0,x1,x2,x3,x4) = x in
x0 <= 4096 /\ x1 <= 4096 /\ x2 <= 4096 /\ x3 <= 4096 /\ x4 <= 65536}
let ( <=* ) (x y:nat5) : Type =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
x0 <= y0 /\ x1 <= y1 /\ x2 <= y2 /\ x3 <= y3 /\ x4 <= y4
let ( +* ) (x y:nat5) : nat5 =
let (x0,x1,x2,x3,x4) = x in
let (y0,y1,y2,y3,y4) = y in
(x0 + y0, x1 + y1, x2 + y2, x3 + y3, x4 + y4) | false | true | Hacl.Spec.K256.Field52.Definitions.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 op_Star_Star (x y: nat5) : nat5 | [] | Hacl.Spec.K256.Field52.Definitions.op_Star_Star | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.K256.Field52.Definitions.nat5 -> y: Hacl.Spec.K256.Field52.Definitions.nat5
-> Hacl.Spec.K256.Field52.Definitions.nat5 | {
"end_col": 47,
"end_line": 100,
"start_col": 30,
"start_line": 97
} |
Prims.Tot | val pow156:(pow156: pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156 | val pow156:(pow156: pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52})
let pow156:(pow156: pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) = | false | null | false | let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.pos",
"Prims.pow2",
"FStar.Pervasives.normalize_term"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104 | false | false | Hacl.Spec.K256.Field52.Definitions.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 pow156:(pow156: pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) | [] | Hacl.Spec.K256.Field52.Definitions.pow156 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pow156:
Prims.pos
{ Prims.pow2 156 == pow156 /\
pow156 ==
(Hacl.Spec.K256.Field52.Definitions.pow52 * Hacl.Spec.K256.Field52.Definitions.pow52) *
Hacl.Spec.K256.Field52.Definitions.pow52 } | {
"end_col": 8,
"end_line": 57,
"start_col": 81,
"start_line": 52
} |
Prims.Tot | val pow208:(pow208: pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": 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 pow208: (pow208:pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) =
let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208 | val pow208:(pow208: pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52})
let pow208:(pow208: pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) = | false | null | false | let pow208:pos = normalize_term (pow2 208) in
assert_norm (pow208 = pow2 208);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
Math.Lemmas.pow2_plus 156 52;
pow208 | {
"checked_file": "Hacl.Spec.K256.Field52.Definitions.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Definitions.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.pos",
"Prims.pow2",
"FStar.Pervasives.normalize_term"
] | [] | module Hacl.Spec.K256.Field52.Definitions
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let felem4 = uint64 & uint64 & uint64 & uint64
noextract
let as_nat4 (f:felem4) =
let (f0, f1, f2, f3) = f in
v f0 + v f1 * pow2 64 + v f2 * pow2 128 + v f3 * pow2 192
inline_for_extraction noextract
let felem5 = uint64 & uint64 & uint64 & uint64 & uint64
[@"opaque_to_smt"]
let pow52: (pow52:pos{pow2 64 == 4096 * pow52 /\ pow2 128 == 16777216 * pow52 * pow52 /\ pow2 52 == pow52}) =
let pow52:pos = normalize_term (pow2 52) in
assert_norm (pow52 = pow2 52);
assert_norm (pow2 64 = 4096 * pow52);
assert_norm (pow2 128 = 16777216 * pow52 * pow52);
pow52
inline_for_extraction noextract
let mask52: x:uint64{v x == pow2 52 - 1} =
assert_norm (pow2 52 - 1 = 0xfffffffffffff);
u64 0xfffffffffffff
inline_for_extraction noextract
let mask48: x:uint64{v x == pow2 48 - 1} =
assert_norm (pow2 48 - 1 = 0xffffffffffff);
u64 0xffffffffffff
[@"opaque_to_smt"]
let pow104: (pow104:pos{pow2 104 == pow104 /\ pow104 == pow52 * pow52}) =
let pow104:pos = normalize_term (pow2 104) in
assert_norm (pow104 = pow2 104);
Math.Lemmas.pow2_plus 52 52;
pow104
[@"opaque_to_smt"]
let pow156: (pow156:pos{pow2 156 == pow156 /\ pow156 == pow52 * pow52 * pow52}) =
let pow156:pos = normalize_term (pow2 156) in
assert_norm (pow156 = pow2 156);
Math.Lemmas.pow2_plus 52 52;
Math.Lemmas.pow2_plus 104 52;
pow156 | false | false | Hacl.Spec.K256.Field52.Definitions.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 pow208:(pow208: pos{pow2 208 == pow208 /\ pow208 == pow52 * pow52 * pow52 * pow52}) | [] | Hacl.Spec.K256.Field52.Definitions.pow208 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pow208:
Prims.pos
{ Prims.pow2 208 == pow208 /\
pow208 ==
((Hacl.Spec.K256.Field52.Definitions.pow52 * Hacl.Spec.K256.Field52.Definitions.pow52) *
Hacl.Spec.K256.Field52.Definitions.pow52) *
Hacl.Spec.K256.Field52.Definitions.pow52 } | {
"end_col": 8,
"end_line": 66,
"start_col": 89,
"start_line": 60
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 legacy_alg = a:hash_alg { a == MD5 \/ a == SHA1 } | let legacy_alg = | false | null | false | a: hash_alg{a == MD5 \/ a == SHA1} | {
"checked_file": "Hacl.Hash.MD.fsti.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Hash.MD.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.l_or",
"Prims.eq2",
"Spec.Hash.Definitions.MD5",
"Spec.Hash.Definitions.SHA1"
] | [] | module Hacl.Hash.MD
open Hacl.Hash.Definitions
open Spec.Hash.Definitions
module U32 = FStar.UInt32 | false | true | Hacl.Hash.MD.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val legacy_alg : Type0 | [] | Hacl.Hash.MD.legacy_alg | {
"file_name": "code/hash/Hacl.Hash.MD.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 53,
"end_line": 8,
"start_col": 17,
"start_line": 8
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 u51 = n:nat{n < 0x8000000000000} | let u51 = | false | null | false | n: nat{n < 0x8000000000000} | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false) | false | true | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u51 : Type0 | [] | Hacl.Impl.Ed25519.PointEqual.u51 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 36,
"end_line": 52,
"start_col": 10,
"start_line": 52
} |
|
FStar.HyperStack.ST.Stack | val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
) | [
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false) | val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
let gte_q s = | true | null | false | let h0 = ST.get () in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL
then true
else
if u64_to_UInt64 s4 <^ 0x00000010000000uL
then false
else
(if u64_to_UInt64 s3 >^ 0x00000000000000uL
then true
else
if u64_to_UInt64 s2 >^ 0x000000000014deuL
then true
else
if u64_to_UInt64 s2 <^ 0x000000000014deuL
then false
else
if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL
then true
else
if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL
then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true else false) | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"FStar.UInt64.op_Greater_Hat",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Prims.bool",
"FStar.UInt64.op_Less_Hat",
"FStar.UInt64.op_Greater_Equals_Hat",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Spec.Ed25519.q",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
) | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
) | [] | Hacl.Impl.Ed25519.PointEqual.gte_q | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul -> FStar.HyperStack.ST.Stack Prims.bool | {
"end_col": 13,
"end_line": 50,
"start_col": 13,
"start_line": 32
} |
FStar.HyperStack.ST.Stack | val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
) | [
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 eq a b =
let a0 = a.(0ul) in
let a1 = a.(1ul) in
let a2 = a.(2ul) in
let a3 = a.(3ul) in
let a4 = a.(4ul) in
let b0 = b.(0ul) in
let b1 = b.(1ul) in
let b2 = b.(2ul) in
let b3 = b.(3ul) in
let b4 = b.(4ul) in
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
assert_norm(pow2 255 - 19 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed);
let h0 = ST.get() in
lemma_equality1 (v a0) (v a1) (v a2) (v a3) (v a4) (v b0) (v b1) (v b2) (v b3) (v b4);
let open Lib.RawIntTypes in
let open FStar.UInt64 in
(u64_to_UInt64 a0 =^ u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =^ u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =^ u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =^ u64_to_UInt64 b3 &&
u64_to_UInt64 a4 =^ u64_to_UInt64 b4) | val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
)
let eq a b = | true | null | false | let a0 = a.(0ul) in
let a1 = a.(1ul) in
let a2 = a.(2ul) in
let a3 = a.(3ul) in
let a4 = a.(4ul) in
let b0 = b.(0ul) in
let b1 = b.(1ul) in
let b2 = b.(2ul) in
let b3 = b.(3ul) in
let b4 = b.(4ul) in
assert_norm (pow2 51 = 0x8000000000000);
assert_norm (pow2 102 = 0x40000000000000000000000000);
assert_norm (pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm (pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
assert_norm (pow2 255 - 19 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed);
let h0 = ST.get () in
lemma_equality1 (v a0) (v a1) (v a2) (v a3) (v a4) (v b0) (v b1) (v b2) (v b3) (v b4);
let open Lib.RawIntTypes in
let open FStar.UInt64 in
(u64_to_UInt64 a0 =^ u64_to_UInt64 b0 && u64_to_UInt64 a1 =^ u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =^ u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =^ u64_to_UInt64 b3 &&
u64_to_UInt64 a4 =^ u64_to_UInt64 b4) | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [] | [
"Hacl.Bignum25519.felem",
"Prims.op_AmpAmp",
"FStar.UInt64.op_Equals_Hat",
"Lib.RawIntTypes.u64_to_UInt64",
"Prims.unit",
"Hacl.Impl.Ed25519.PointEqual.lemma_equality1",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.bool",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2",
"Lib.IntTypes.int_t",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false)
let u51 = n:nat{n < 0x8000000000000}
val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
open FStar.Calc
#push-options "--z3rlimit 100"
let lemma_equality1 a b c d e a' b' c' d' e' =
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp () : Lemma
(requires a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
=
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) + pow2 153 * (pow2 51 - 1) < pow2 204);
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)
}
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)
}
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)
}
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)
}
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc (==) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b)
(pow2 102 * c)
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)
}
(a + pow2 51 * b) % (pow2 102);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)
}
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102)
(a + pow2 51 * b)
(a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp () : Lemma
(requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
= ()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp ()
val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
) | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
) | [] | Hacl.Impl.Ed25519.PointEqual.eq | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Bignum25519.felem -> b: Hacl.Bignum25519.felem -> FStar.HyperStack.ST.Stack Prims.bool | {
"end_col": 40,
"end_line": 216,
"start_col": 12,
"start_line": 192
} |
FStar.HyperStack.ST.Stack | val point_equal:
p:point
-> q:point ->
Stack bool
(requires fun h -> live h p /\ live h q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies0 h0 h1 /\
(z <==> Spec.Ed25519.point_equal (F51.point_eval h0 p) (F51.point_eval h0 q))
) | [
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 point_equal p q =
push_frame();
let tmp = create 20ul (u64 0) in
let b = point_equal_1 p q tmp in
let res = if b then point_equal_2 p q tmp else false in
pop_frame();
res | val point_equal:
p:point
-> q:point ->
Stack bool
(requires fun h -> live h p /\ live h q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies0 h0 h1 /\
(z <==> Spec.Ed25519.point_equal (F51.point_eval h0 p) (F51.point_eval h0 q))
)
let point_equal p q = | true | null | false | push_frame ();
let tmp = create 20ul (u64 0) in
let b = point_equal_1 p q tmp in
let res = if b then point_equal_2 p q tmp else false in
pop_frame ();
res | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [] | [
"Hacl.Bignum25519.point",
"Prims.bool",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Impl.Ed25519.PointEqual.point_equal_2",
"Hacl.Impl.Ed25519.PointEqual.point_equal_1",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u64",
"Lib.Buffer.lbuffer",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false)
let u51 = n:nat{n < 0x8000000000000}
val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
open FStar.Calc
#push-options "--z3rlimit 100"
let lemma_equality1 a b c d e a' b' c' d' e' =
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp () : Lemma
(requires a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
=
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) + pow2 153 * (pow2 51 - 1) < pow2 204);
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)
}
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)
}
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)
}
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)
}
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc (==) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b)
(pow2 102 * c)
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)
}
(a + pow2 51 * b) % (pow2 102);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)
}
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102)
(a + pow2 51 * b)
(a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp () : Lemma
(requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
= ()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp ()
val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
)
[@CInline]
let eq a b =
let a0 = a.(0ul) in
let a1 = a.(1ul) in
let a2 = a.(2ul) in
let a3 = a.(3ul) in
let a4 = a.(4ul) in
let b0 = b.(0ul) in
let b1 = b.(1ul) in
let b2 = b.(2ul) in
let b3 = b.(3ul) in
let b4 = b.(4ul) in
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
assert_norm(pow2 255 - 19 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed);
let h0 = ST.get() in
lemma_equality1 (v a0) (v a1) (v a2) (v a3) (v a4) (v b0) (v b1) (v b2) (v b3) (v b4);
let open Lib.RawIntTypes in
let open FStar.UInt64 in
(u64_to_UInt64 a0 =^ u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =^ u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =^ u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =^ u64_to_UInt64 b3 &&
u64_to_UInt64 a4 =^ u64_to_UInt64 b4)
inline_for_extraction noextract
val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
)
let point_equal_1 p q tmp =
let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
let h0 = ST.get() in
fmul pxqz (getx p) (getz q);
reduce pxqz;
fmul qxpz (getx q) (getz p);
reduce qxpz;
eq pxqz qxpz
inline_for_extraction noextract
val point_equal_2:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z == (if ((py `SC.fmul` qz) <> (qy `SC.fmul` pz)) then false else true))
)
let point_equal_2 p q tmp =
let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
fmul pyqz (gety p) (getz q);
reduce pyqz;
fmul qypz (gety q) (getz p);
reduce qypz;
eq pyqz qypz
val point_equal:
p:point
-> q:point ->
Stack bool
(requires fun h -> live h p /\ live h q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies0 h0 h1 /\
(z <==> Spec.Ed25519.point_equal (F51.point_eval h0 p) (F51.point_eval h0 q))
) | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val point_equal:
p:point
-> q:point ->
Stack bool
(requires fun h -> live h p /\ live h q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies0 h0 h1 /\
(z <==> Spec.Ed25519.point_equal (F51.point_eval h0 p) (F51.point_eval h0 q))
) | [] | Hacl.Impl.Ed25519.PointEqual.point_equal | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Hacl.Bignum25519.point -> q: Hacl.Bignum25519.point -> FStar.HyperStack.ST.Stack Prims.bool | {
"end_col": 5,
"end_line": 296,
"start_col": 2,
"start_line": 291
} |
FStar.HyperStack.ST.Stack | val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
) | [
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 point_equal_1 p q tmp =
let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
let h0 = ST.get() in
fmul pxqz (getx p) (getz q);
reduce pxqz;
fmul qxpz (getx q) (getz p);
reduce qxpz;
eq pxqz qxpz | val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
)
let point_equal_1 p q tmp = | true | null | false | let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
let h0 = ST.get () in
fmul pxqz (getx p) (getz q);
reduce pxqz;
fmul qxpz (getx q) (getz p);
reduce qxpz;
eq pxqz qxpz | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [] | [
"Hacl.Bignum25519.point",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Ed25519.PointEqual.eq",
"Prims.bool",
"Prims.unit",
"Hacl.Bignum25519.reduce",
"Hacl.Bignum25519.fmul",
"Hacl.Bignum25519.felem",
"Hacl.Bignum25519.getz",
"Hacl.Bignum25519.getx",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false)
let u51 = n:nat{n < 0x8000000000000}
val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
open FStar.Calc
#push-options "--z3rlimit 100"
let lemma_equality1 a b c d e a' b' c' d' e' =
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp () : Lemma
(requires a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
=
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) + pow2 153 * (pow2 51 - 1) < pow2 204);
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)
}
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)
}
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)
}
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)
}
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc (==) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b)
(pow2 102 * c)
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)
}
(a + pow2 51 * b) % (pow2 102);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)
}
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102)
(a + pow2 51 * b)
(a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp () : Lemma
(requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
= ()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp ()
val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
)
[@CInline]
let eq a b =
let a0 = a.(0ul) in
let a1 = a.(1ul) in
let a2 = a.(2ul) in
let a3 = a.(3ul) in
let a4 = a.(4ul) in
let b0 = b.(0ul) in
let b1 = b.(1ul) in
let b2 = b.(2ul) in
let b3 = b.(3ul) in
let b4 = b.(4ul) in
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
assert_norm(pow2 255 - 19 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed);
let h0 = ST.get() in
lemma_equality1 (v a0) (v a1) (v a2) (v a3) (v a4) (v b0) (v b1) (v b2) (v b3) (v b4);
let open Lib.RawIntTypes in
let open FStar.UInt64 in
(u64_to_UInt64 a0 =^ u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =^ u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =^ u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =^ u64_to_UInt64 b3 &&
u64_to_UInt64 a4 =^ u64_to_UInt64 b4)
inline_for_extraction noextract
val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
) | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
) | [] | Hacl.Impl.Ed25519.PointEqual.point_equal_1 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
p: Hacl.Bignum25519.point ->
q: Hacl.Bignum25519.point ->
tmp: Lib.Buffer.lbuffer Lib.IntTypes.uint64 20ul
-> FStar.HyperStack.ST.Stack Prims.bool | {
"end_col": 14,
"end_line": 247,
"start_col": 27,
"start_line": 237
} |
FStar.HyperStack.ST.Stack | val point_equal_2:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z == (if ((py `SC.fmul` qz) <> (qy `SC.fmul` pz)) then false else true))
) | [
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 point_equal_2 p q tmp =
let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
fmul pyqz (gety p) (getz q);
reduce pyqz;
fmul qypz (gety q) (getz p);
reduce qypz;
eq pyqz qypz | val point_equal_2:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z == (if ((py `SC.fmul` qz) <> (qy `SC.fmul` pz)) then false else true))
)
let point_equal_2 p q tmp = | true | null | false | let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
fmul pyqz (gety p) (getz q);
reduce pyqz;
fmul qypz (gety q) (getz p);
reduce qypz;
eq pyqz qypz | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [] | [
"Hacl.Bignum25519.point",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Ed25519.PointEqual.eq",
"Prims.bool",
"Prims.unit",
"Hacl.Bignum25519.reduce",
"Hacl.Bignum25519.fmul",
"Hacl.Bignum25519.felem",
"Hacl.Bignum25519.getz",
"Hacl.Bignum25519.gety",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false)
let u51 = n:nat{n < 0x8000000000000}
val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
open FStar.Calc
#push-options "--z3rlimit 100"
let lemma_equality1 a b c d e a' b' c' d' e' =
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp () : Lemma
(requires a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
=
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) + pow2 153 * (pow2 51 - 1) < pow2 204);
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)
}
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)
}
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)
}
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)
}
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc (==) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b)
(pow2 102 * c)
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)
}
(a + pow2 51 * b) % (pow2 102);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)
}
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102)
(a + pow2 51 * b)
(a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp () : Lemma
(requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
= ()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp ()
val eq:
a:felem
-> b:felem ->
Stack bool
(requires fun h -> live h a /\ live h b /\
F51.fevalh h a == F51.as_nat h a /\
F51.fevalh h b == F51.as_nat h b /\
F51.felem_fits h a (1, 1, 1, 1, 1) /\
F51.felem_fits h b (1, 1, 1, 1, 1)
)
(ensures fun h0 r h1 -> h0 == h1 /\
(r <==> F51.fevalh h0 a == F51.fevalh h0 b)
)
[@CInline]
let eq a b =
let a0 = a.(0ul) in
let a1 = a.(1ul) in
let a2 = a.(2ul) in
let a3 = a.(3ul) in
let a4 = a.(4ul) in
let b0 = b.(0ul) in
let b1 = b.(1ul) in
let b2 = b.(2ul) in
let b3 = b.(3ul) in
let b4 = b.(4ul) in
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
assert_norm(pow2 255 - 19 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed);
let h0 = ST.get() in
lemma_equality1 (v a0) (v a1) (v a2) (v a3) (v a4) (v b0) (v b1) (v b2) (v b3) (v b4);
let open Lib.RawIntTypes in
let open FStar.UInt64 in
(u64_to_UInt64 a0 =^ u64_to_UInt64 b0 &&
u64_to_UInt64 a1 =^ u64_to_UInt64 b1 &&
u64_to_UInt64 a2 =^ u64_to_UInt64 b2 &&
u64_to_UInt64 a3 =^ u64_to_UInt64 b3 &&
u64_to_UInt64 a4 =^ u64_to_UInt64 b4)
inline_for_extraction noextract
val point_equal_1:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\ live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z <==> ((px `SC.fmul` qz) == (qx `SC.fmul` pz))
)
)
let point_equal_1 p q tmp =
let pxqz = sub tmp 0ul 5ul in
let qxpz = sub tmp 5ul 5ul in
let pyqz = sub tmp 10ul 5ul in
let qypz = sub tmp 15ul 5ul in
let h0 = ST.get() in
fmul pxqz (getx p) (getz q);
reduce pxqz;
fmul qxpz (getx q) (getz p);
reduce qxpz;
eq pxqz qxpz
inline_for_extraction noextract
val point_equal_2:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z == (if ((py `SC.fmul` qz) <> (qy `SC.fmul` pz)) then false else true))
) | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val point_equal_2:
p:point
-> q:point
-> tmp:lbuffer uint64 20ul ->
Stack bool
(requires fun h ->
live h p /\ live h q /\live h tmp /\
disjoint tmp p /\ disjoint tmp q /\
F51.point_inv_t h p /\ F51.point_inv_t h q
)
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
(let px, py, pz, pt = F51.point_eval h0 p in
let qx, qy, qz, qt = F51.point_eval h0 q in
z == (if ((py `SC.fmul` qz) <> (qy `SC.fmul` pz)) then false else true))
) | [] | Hacl.Impl.Ed25519.PointEqual.point_equal_2 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
p: Hacl.Bignum25519.point ->
q: Hacl.Bignum25519.point ->
tmp: Lib.Buffer.lbuffer Lib.IntTypes.uint64 20ul
-> FStar.HyperStack.ST.Stack Prims.bool | {
"end_col": 14,
"end_line": 276,
"start_col": 27,
"start_line": 267
} |
FStar.Pervasives.Lemma | val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')) | [
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": 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 lemma_equality1 a b c d e a' b' c' d' e' =
assert_norm(pow2 51 = 0x8000000000000);
assert_norm(pow2 102 = 0x40000000000000000000000000);
assert_norm(pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm(pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp () : Lemma
(requires a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
=
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) + pow2 153 * (pow2 51 - 1) < pow2 204);
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)
}
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)
}
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc (==) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)
}
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)
}
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc (==) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a + pow2 51 * b)
(pow2 102 * c)
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)
}
(a + pow2 51 * b) % (pow2 102);
};
calc (==) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
(==) { FStar.Math.Lemmas.lemma_mod_plus_distr_r
(a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)
}
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102)
(a + pow2 51 * b)
(a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp () : Lemma
(requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
= ()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp () | val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
let lemma_equality1 a b c d e a' b' c' d' e' = | false | null | true | assert_norm (pow2 51 = 0x8000000000000);
assert_norm (pow2 102 = 0x40000000000000000000000000);
assert_norm (pow2 153 = 0x200000000000000000000000000000000000000);
assert_norm (pow2 204 = 0x1000000000000000000000000000000000000000000000000000);
let lemma_l_imp ()
: Lemma
(requires
a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e')
(ensures a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e') =
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 51) b' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 102) c' (pow2 51 - 1);
FStar.Math.Lemmas.lemma_mult_le_left (pow2 153) d' (pow2 51 - 1);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) < pow2 102);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) < pow2 153);
assert_norm (pow2 51 - 1 + pow2 51 * (pow2 51 - 1) + pow2 102 * (pow2 51 - 1) +
pow2 153 * (pow2 51 - 1) <
pow2 204);
calc ( == ) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e) % (pow2 204);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a + pow2 51 * b + pow2 102 * c +
pow2 153 * d)
(pow2 204 * e)
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e (pow2 204)) }
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 204);
};
calc ( == ) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') % (pow2 204);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a' + pow2 51 * b' + pow2 102 * c' +
pow2 153 * d')
(pow2 204 * e')
(pow2 204);
FStar.Math.Lemmas.cancel_mul_mod e' (pow2 204)) }
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 204);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 204)
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d)
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d');
calc ( == ) {
(a + pow2 51 * b + pow2 102 * c + pow2 153 * d) % (pow2 153);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a + pow2 51 * b + pow2 102 * c)
(pow2 153 * d)
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d (pow2 153)) }
(a + pow2 51 * b + pow2 102 * c) % (pow2 153);
};
calc ( == ) {
(a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d') % (pow2 153);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a' + pow2 51 * b' + pow2 102 * c')
(pow2 153 * d')
(pow2 153);
FStar.Math.Lemmas.cancel_mul_mod d' (pow2 153)) }
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 153);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 153)
(a + pow2 51 * b + pow2 102 * c)
(a' + pow2 51 * b' + pow2 102 * c');
calc ( == ) {
(a + pow2 51 * b + pow2 102 * c) % (pow2 102);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a + pow2 51 * b) (pow2 102 * c) (pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c (pow2 102)) }
(a + pow2 51 * b) % (pow2 102);
};
calc ( == ) {
(a' + pow2 51 * b' + pow2 102 * c') % (pow2 102);
( == ) { (FStar.Math.Lemmas.lemma_mod_plus_distr_r (a' + pow2 51 * b')
(pow2 102 * c')
(pow2 102);
FStar.Math.Lemmas.cancel_mul_mod c' (pow2 102)) }
(a' + pow2 51 * b') % (pow2 102);
};
FStar.Math.Lemmas.lemma_mod_injective (pow2 102) (a + pow2 51 * b) (a' + pow2 51 * b');
FStar.Math.Lemmas.cancel_mul_mod b (pow2 51);
FStar.Math.Lemmas.cancel_mul_mod b' (pow2 51);
FStar.Math.Lemmas.lemma_mod_injective (pow2 51) a a'
in
let lemma_r_imp ()
: Lemma (requires a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')
(ensures
a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') =
()
in
Classical.move_requires lemma_l_imp ();
Classical.move_requires lemma_r_imp () | {
"checked_file": "Hacl.Impl.Ed25519.PointEqual.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt64.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.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointEqual.fst"
} | [
"lemma"
] | [
"Hacl.Impl.Ed25519.PointEqual.u51",
"FStar.Classical.move_requires",
"Prims.unit",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.squash",
"Prims.op_Multiply",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Math.Lemmas.lemma_mod_injective",
"FStar.Math.Lemmas.cancel_mul_mod",
"FStar.Calc.calc_finish",
"Prims.op_Modulus",
"Prims.Cons",
"FStar.Preorder.relation",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.lemma_mod_plus_distr_r",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Subtraction",
"FStar.Math.Lemmas.lemma_mult_le_left",
"Prims.op_Equality"
] | [] | module Hacl.Impl.Ed25519.PointEqual
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
#reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0"
val gte_q:
s:lbuffer uint64 5ul ->
Stack bool
(requires fun h -> live h s /\
F56.qelem_fits h s (1, 1, 1, 1, 1)
)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> F56.as_nat h0 s >= Spec.Ed25519.q)
)
[@CInline]
let gte_q s =
let h0 = ST.get() in
let s0 = s.(0ul) in
let s1 = s.(1ul) in
let s2 = s.(2ul) in
let s3 = s.(3ul) in
let s4 = s.(4ul) in
assert_norm (Spec.Ed25519.q == 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed);
let open FStar.UInt64 in
let open Lib.RawIntTypes in
if u64_to_UInt64 s4 >^ 0x00000010000000uL then true
else if u64_to_UInt64 s4 <^ 0x00000010000000uL then false
else (if u64_to_UInt64 s3 >^ 0x00000000000000uL then true
else if u64_to_UInt64 s2 >^ 0x000000000014deuL then true
else if u64_to_UInt64 s2 <^ 0x000000000014deuL then false
else if u64_to_UInt64 s1 >^ 0xf9dea2f79cd658uL then true
else if u64_to_UInt64 s1 <^ 0xf9dea2f79cd658uL then false
else if u64_to_UInt64 s0 >=^ 0x12631a5cf5d3eduL then true
else false)
let u51 = n:nat{n < 0x8000000000000}
val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e'))
open FStar.Calc
#push-options "--z3rlimit 100" | false | false | Hacl.Impl.Ed25519.PointEqual.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_equality1:
a:u51 -> b:u51 -> c:u51 -> d:u51 -> e:u51 ->
a':u51 -> b':u51 -> c':u51 -> d':u51 -> e':u51 ->
Lemma (requires a < pow2 51 /\ b < pow2 51 /\ c < pow2 51 /\ d < pow2 51 /\ e < pow2 51 /\
a' < pow2 51 /\ b' < pow2 51 /\ c' < pow2 51 /\ d' < pow2 51 /\ e' < pow2 51)
(ensures (a + pow2 51 * b + pow2 102 * c + pow2 153 * d + pow2 204 * e ==
a' + pow2 51 * b' + pow2 102 * c' + pow2 153 * d' + pow2 204 * e') <==>
(a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e')) | [] | Hacl.Impl.Ed25519.PointEqual.lemma_equality1 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointEqual.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Hacl.Impl.Ed25519.PointEqual.u51 ->
b: Hacl.Impl.Ed25519.PointEqual.u51 ->
c: Hacl.Impl.Ed25519.PointEqual.u51 ->
d: Hacl.Impl.Ed25519.PointEqual.u51 ->
e: Hacl.Impl.Ed25519.PointEqual.u51 ->
a': Hacl.Impl.Ed25519.PointEqual.u51 ->
b': Hacl.Impl.Ed25519.PointEqual.u51 ->
c': Hacl.Impl.Ed25519.PointEqual.u51 ->
d': Hacl.Impl.Ed25519.PointEqual.u51 ->
e': Hacl.Impl.Ed25519.PointEqual.u51
-> FStar.Pervasives.Lemma
(requires
a < Prims.pow2 51 /\ b < Prims.pow2 51 /\ c < Prims.pow2 51 /\ d < Prims.pow2 51 /\
e < Prims.pow2 51 /\ a' < Prims.pow2 51 /\ b' < Prims.pow2 51 /\ c' < Prims.pow2 51 /\
d' < Prims.pow2 51 /\ e' < Prims.pow2 51)
(ensures
a + Prims.pow2 51 * b + Prims.pow2 102 * c + Prims.pow2 153 * d + Prims.pow2 204 * e ==
a' + Prims.pow2 51 * b' + Prims.pow2 102 * c' + Prims.pow2 153 * d' + Prims.pow2 204 * e' <==>
a == a' /\ b == b' /\ c == c' /\ d == d' /\ e == e') | {
"end_col": 40,
"end_line": 174,
"start_col": 2,
"start_line": 69
} |
Prims.Tot | val cs:S.ciphersuite | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Hash"
},
{
"abbrev": true,
"full_module": "Spec.Agile.AEAD",
"short_module": "AEAD"
},
{
"abbrev": true,
"full_module": "Spec.Agile.DH",
"short_module": "DH"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HPKE",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": 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 cs:S.ciphersuite = (DH.DH_P256, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_256) | val cs:S.ciphersuite
let cs:S.ciphersuite = | false | null | false | (DH.DH_P256, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_256) | {
"checked_file": "Hacl.HPKE.P256_CP128_SHA256.fsti.checked",
"dependencies": [
"Spec.Agile.HPKE.fsti.checked",
"Spec.Agile.Hash.fsti.checked",
"Spec.Agile.DH.fst.checked",
"Spec.Agile.AEAD.fsti.checked",
"prims.fst.checked",
"Hacl.Impl.HPKE.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.HPKE.P256_CP128_SHA256.fsti"
} | [
"total"
] | [
"FStar.Pervasives.Native.Mktuple4",
"Spec.Agile.DH.algorithm",
"Spec.Agile.HPKE.hash_algorithm",
"Spec.Agile.HPKE.aead",
"Spec.Hash.Definitions.hash_alg",
"Spec.Agile.DH.DH_P256",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Agile.HPKE.Seal",
"Spec.Agile.AEAD.CHACHA20_POLY1305"
] | [] | module Hacl.HPKE.P256_CP128_SHA256
open Hacl.Impl.HPKE
module S = Spec.Agile.HPKE
module DH = Spec.Agile.DH
module AEAD = Spec.Agile.AEAD
module Hash = Spec.Agile.Hash | false | true | Hacl.HPKE.P256_CP128_SHA256.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val cs:S.ciphersuite | [] | Hacl.HPKE.P256_CP128_SHA256.cs | {
"file_name": "code/hpke/Hacl.HPKE.P256_CP128_SHA256.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Spec.Agile.HPKE.ciphersuite | {
"end_col": 96,
"end_line": 10,
"start_col": 23,
"start_line": 10
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": 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 norm_steps = [delta_attr [`%Norm]; iota; zeta; primops] | let norm_steps = | false | null | false | [delta_attr [`%Norm]; iota; zeta; primops] | {
"checked_file": "LowParse.Norm.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Norm.fst"
} | [
"total"
] | [
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_attr",
"Prims.string",
"Prims.Nil",
"FStar.Pervasives.iota",
"FStar.Pervasives.zeta",
"FStar.Pervasives.primops"
] | [] | module LowParse.Norm
noeq
type norm_t : Type = | Norm | false | true | LowParse.Norm.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 norm_steps : Prims.list FStar.Pervasives.norm_step | [] | LowParse.Norm.norm_steps | {
"file_name": "src/lowparse/LowParse.Norm.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Prims.list FStar.Pervasives.norm_step | {
"end_col": 59,
"end_line": 6,
"start_col": 17,
"start_line": 6
} |
|
Prims.Tot | val compute_blake2s_128:compute_st Blake2S | [
{
"abbrev": false,
"full_module": "Hacl.Hash.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Hacl.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HMAC",
"short_module": null
},
{
"abbrev": 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 compute_blake2s_128: compute_st Blake2S =
mk_compute (D.mk_impl Blake2S Hacl.Impl.Blake2.Core.M128)
hash_blake2s_128 alloca_blake2s_128 init_blake2s_128
update_multi_blake2s_128 update_last_blake2s_128 finish_blake2s_128 | val compute_blake2s_128:compute_st Blake2S
let compute_blake2s_128:compute_st Blake2S = | false | null | false | mk_compute (D.mk_impl Blake2S Hacl.Impl.Blake2.Core.M128)
hash_blake2s_128
alloca_blake2s_128
init_blake2s_128
update_multi_blake2s_128
update_last_blake2s_128
finish_blake2s_128 | {
"checked_file": "Hacl.HMAC.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"EverCrypt.Helpers.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.HMAC.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.HMAC.mk_compute",
"Hacl.Hash.Definitions.mk_impl",
"Spec.Hash.Definitions.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Hash.Blake2.hash_blake2s_128",
"Hacl.Hash.Blake2.alloca_blake2s_128",
"Hacl.Hash.Blake2.init_blake2s_128",
"Hacl.Hash.Blake2.update_multi_blake2s_128",
"Hacl.Hash.Blake2.update_last_blake2s_128",
"Hacl.Hash.Blake2.finish_blake2s_128"
] | [] | module Hacl.HMAC.Blake2s_128
module B = LowStar.Buffer
module D = Hacl.Hash.Definitions
open Spec.Agile.HMAC
open Spec.Hash.Definitions
open FStar.HyperStack.ST
open Lib.IntTypes
open EverCrypt.Helpers
open Hacl.HMAC
open Hacl.Hash.Blake2
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
[@@ Comment "Write the HMAC-BLAKE2s MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 64 bytes.
`dst` must point to 32 bytes of memory."] | false | true | Hacl.HMAC.Blake2s_128.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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_blake2s_128:compute_st Blake2S | [] | Hacl.HMAC.Blake2s_128.compute_blake2s_128 | {
"file_name": "code/hmac/Hacl.HMAC.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.HMAC.compute_st Spec.Hash.Definitions.Blake2S | {
"end_col": 80,
"end_line": 25,
"start_col": 2,
"start_line": 23
} |
Prims.Tot | val sel_curry (m: t) (f: flag) : flag_val_t | [
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Map16",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sel_curry (m:t) (f:flag) : flag_val_t = sel f m | val sel_curry (m: t) (f: flag) : flag_val_t
let sel_curry (m: t) (f: flag) : flag_val_t = | false | null | false | sel f m | {
"checked_file": "Vale.X64.Flags.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Flags.fsti"
} | [
"total"
] | [
"Vale.X64.Flags.t",
"Vale.X64.Machine_s.flag",
"Vale.X64.Flags.sel",
"Vale.X64.Flags.flag_val_t"
] | [] | module Vale.X64.Flags
open FStar.Mul
// This interface should not refer to Semantics_s
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Lib.Map16
unfold let flag_val_t = option bool // HACK: this shouldn't have to be unfolded (it has to do with the lambda in FStar.FunctionalExtensionality.(^->))
val t : Type0
val sel (f:flag) (m:t) : flag_val_t
val upd (f:flag) (v:flag_val_t) (m:t) : t | false | true | Vale.X64.Flags.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 sel_curry (m: t) (f: flag) : flag_val_t | [] | Vale.X64.Flags.sel_curry | {
"file_name": "vale/code/arch/x64/Vale.X64.Flags.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.X64.Flags.t -> f: Vale.X64.Machine_s.flag -> Vale.X64.Flags.flag_val_t | {
"end_col": 51,
"end_line": 17,
"start_col": 44,
"start_line": 17
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.Map16",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let flag_val_t = option bool | let flag_val_t = | false | null | false | option bool | {
"checked_file": "Vale.X64.Flags.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Flags.fsti"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"Prims.bool"
] | [] | module Vale.X64.Flags
open FStar.Mul
// This interface should not refer to Semantics_s
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Lib.Map16 | false | true | Vale.X64.Flags.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 flag_val_t : Type0 | [] | Vale.X64.Flags.flag_val_t | {
"file_name": "vale/code/arch/x64/Vale.X64.Flags.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 35,
"end_line": 9,
"start_col": 24,
"start_line": 9
} |
|
Prims.Tot | val to_fun (m: t) : (FStar.FunctionalExtensionality.restricted_t flag (fun _ -> flag_val_t)) | [
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Map16",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let to_fun (m:t) : (FStar.FunctionalExtensionality.restricted_t flag (fun _ -> flag_val_t)) =
FStar.FunctionalExtensionality.on flag (sel_curry m) | val to_fun (m: t) : (FStar.FunctionalExtensionality.restricted_t flag (fun _ -> flag_val_t))
let to_fun (m: t) : (FStar.FunctionalExtensionality.restricted_t flag (fun _ -> flag_val_t)) = | false | null | false | FStar.FunctionalExtensionality.on flag (sel_curry m) | {
"checked_file": "Vale.X64.Flags.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Prop_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Flags.fsti"
} | [
"total"
] | [
"Vale.X64.Flags.t",
"FStar.FunctionalExtensionality.on",
"Vale.X64.Machine_s.flag",
"Vale.X64.Flags.flag_val_t",
"Vale.X64.Flags.sel_curry",
"FStar.FunctionalExtensionality.restricted_t"
] | [] | module Vale.X64.Flags
open FStar.Mul
// This interface should not refer to Semantics_s
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Lib.Map16
unfold let flag_val_t = option bool // HACK: this shouldn't have to be unfolded (it has to do with the lambda in FStar.FunctionalExtensionality.(^->))
val t : Type0
val sel (f:flag) (m:t) : flag_val_t
val upd (f:flag) (v:flag_val_t) (m:t) : t
let sel_curry (m:t) (f:flag) : flag_val_t = sel f m | false | false | Vale.X64.Flags.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 to_fun (m: t) : (FStar.FunctionalExtensionality.restricted_t flag (fun _ -> flag_val_t)) | [] | Vale.X64.Flags.to_fun | {
"file_name": "vale/code/arch/x64/Vale.X64.Flags.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.X64.Flags.t
-> FStar.FunctionalExtensionality.restricted_t Vale.X64.Machine_s.flag
(fun _ -> Vale.X64.Flags.flag_val_t) | {
"end_col": 54,
"end_line": 20,
"start_col": 2,
"start_line": 20
} |
FStar.All.ML | val test_inline: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline () : FStar.All.ML unit =
test_inline_mov_input ();
test_inline_mov_add_input ();
test_inline_mul_inputs ();
test_inline_mov_mul_rax_100 ();
test_inline_mov_mul_inputs ();
// This test leads (rightfully) to a failure in the printer due to a gcc bug
// test_inline_mov_add_input_dummy_mul ();
test_inline_comment_add ();
test_inline_same_line ();
test_inline_same_line_newline ();
() | val test_inline: Prims.unit -> FStar.All.ML unit
let test_inline () : FStar.All.ML unit = | true | null | false | test_inline_mov_input ();
test_inline_mov_add_input ();
test_inline_mul_inputs ();
test_inline_mov_mul_rax_100 ();
test_inline_mov_mul_inputs ();
test_inline_comment_add ();
test_inline_same_line ();
test_inline_same_line_newline ();
() | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.test_inline_same_line_newline",
"Vale.Test.TestInline.test_inline_same_line",
"Vale.Test.TestInline.test_inline_comment_add",
"Vale.Test.TestInline.test_inline_mov_mul_inputs",
"Vale.Test.TestInline.test_inline_mov_mul_rax_100",
"Vale.Test.TestInline.test_inline_mul_inputs",
"Vale.Test.TestInline.test_inline_mov_add_input",
"Vale.Test.TestInline.test_inline_mov_input"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c
let test_inline_mov_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c
// This test generates the correct inline assembly code, but only works with gcc >= 9
// On prior versions, gcc ignores the register asm("rax") annotation, and does not correctly
// allocate the output "result" into register rax
(*
let test_inline_mov_add_input_dummy_mul () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Mul64 (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input_dummy_mul" (Some "result") args regs_mod c
*)
let test_inline_comment_add () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let s = "This is a comment" in
let c = Block [
Ins (make_instr_annotate (ins_Comment s) (AnnotateComment s));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_comment_add" (Some "result") args regs_mod c
let test_inline_same_line () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let c = Block [
Ins (make_instr_annotate (ins_Space 0) (AnnotateSpace 0));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_same_line" (Some "result") args regs_mod c
let test_inline_same_line_newline () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let c = Block [
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr_annotate ins_Newline (AnnotateNewline ()));
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rRax));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_same_line_newline" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 4,
"end_line": 160,
"start_col": 2,
"start_line": 150
} |
FStar.All.ML | val test_inline_mov_input: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c | val test_inline_mov_input: Prims.unit -> FStar.All.ML unit
let test_inline_mov_input () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15))] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rR15",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRdx",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
() | false | false | Vale.Test.TestInline.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 test_inline_mov_input: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_mov_input | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 72,
"end_line": 39,
"start_col": 50,
"start_line": 31
} |
FStar.All.ML | val print_function
(name: string)
(ret_val: option string)
(args: list (string & td & reg_64))
(regs_mod: (reg_64 -> bool))
(c: code)
: FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
() | val print_function
(name: string)
(ret_val: option string)
(args: list (string & td & reg_64))
(regs_mod: (reg_64 -> bool))
(c: code)
: FStar.All.ML unit
let print_function
(name: string)
(ret_val: option string)
(args: list (string & td & reg_64))
(regs_mod: (reg_64 -> bool))
(c: code)
: FStar.All.ML unit = | true | null | false | let len = List.length args in
let arg_names n =
match List.Tot.nth args n with
| None -> ""
| Some (x, _, _) -> x
in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n: reg_nat len) : reg_64 =
match List.Tot.nth args n with
| None -> 0
| Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
() | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.string",
"FStar.Pervasives.Native.option",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_Semantics_s.code",
"Prims.unit",
"Prims.int",
"Vale.X64.Print_Inline_s.print_inline",
"Prims.Nil",
"Vale.Interop.X64.reg_nat",
"FStar.List.Tot.Base.nth",
"FStar.List.Tot.Base.map",
"Prims.nat",
"FStar.List.Tot.Base.length"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code) | false | false | Vale.Test.TestInline.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 print_function
(name: string)
(ret_val: option string)
(args: list (string & td & reg_64))
(regs_mod: (reg_64 -> bool))
(c: code)
: FStar.All.ML unit | [] | Vale.Test.TestInline.print_function | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
name: Prims.string ->
ret_val: FStar.Pervasives.Native.option Prims.string ->
args: Prims.list ((Prims.string * Vale.Interop.Base.td) * Vale.X64.Machine_s.reg_64) ->
regs_mod: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code
-> FStar.All.ML Prims.unit | {
"end_col": 4,
"end_line": 29,
"start_col": 3,
"start_line": 21
} |
FStar.All.ML | val test_inline_mul_inputs: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c | val test_inline_mul_inputs: Prims.unit -> FStar.All.ML unit
let test_inline_mul_inputs () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rRbx); ("second_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rRax || r = rRdx) in
let c =
Block
[
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15))
]
in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_IMul64",
"Vale.X64.Machine_s.rR15",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRdx",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_mul_inputs: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_mul_inputs | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 73,
"end_line": 62,
"start_col": 51,
"start_line": 52
} |
FStar.All.ML | val test_inline_mov_add_input: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c | val test_inline_mov_add_input: Prims.unit -> FStar.All.ML unit
let test_inline_mov_add_input () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rRax || r = rRdx) in
let c =
Block
[
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1))
]
in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Instruction_s.opFlagsCf",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_Add64",
"Vale.X64.Machine_s.OConst",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRdx",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_mov_add_input: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_mov_add_input | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 76,
"end_line": 50,
"start_col": 54,
"start_line": 41
} |
FStar.All.ML | val test_inline_same_line: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_same_line () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let c = Block [
Ins (make_instr_annotate (ins_Space 0) (AnnotateSpace 0));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_same_line" (Some "result") args regs_mod c | val test_inline_same_line: Prims.unit -> FStar.All.ML unit
let test_inline_same_line () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rR15 || r = rRax) in
let c =
Block
[
Ins (make_instr_annotate (ins_Space 0) (AnnotateSpace 0));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15))
]
in
print_function "test_inline_same_line" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr_annotate",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Space",
"Vale.X64.Machine_Semantics_s.AnnotateSpace",
"Vale.X64.Instruction_s.InstrTypeRecord",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.opFlagsCf",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.op64",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_Add64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.rRax",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c
let test_inline_mov_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c
// This test generates the correct inline assembly code, but only works with gcc >= 9
// On prior versions, gcc ignores the register asm("rax") annotation, and does not correctly
// allocate the output "result" into register rax
(*
let test_inline_mov_add_input_dummy_mul () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Mul64 (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input_dummy_mul" (Some "result") args regs_mod c
*)
let test_inline_comment_add () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let s = "This is a comment" in
let c = Block [
Ins (make_instr_annotate (ins_Comment s) (AnnotateComment s));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_comment_add" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_same_line: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_same_line | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 72,
"end_line": 130,
"start_col": 50,
"start_line": 120
} |
FStar.All.ML | val test_inline_comment_add: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_comment_add () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let s = "This is a comment" in
let c = Block [
Ins (make_instr_annotate (ins_Comment s) (AnnotateComment s));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_comment_add" (Some "result") args regs_mod c | val test_inline_comment_add: Prims.unit -> FStar.All.ML unit
let test_inline_comment_add () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rR15 || r = rRax) in
let s = "This is a comment" in
let c =
Block
[
Ins (make_instr_annotate (ins_Comment s) (AnnotateComment s));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15))
]
in
print_function "test_inline_comment_add" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr_annotate",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Comment",
"Vale.X64.Machine_Semantics_s.AnnotateComment",
"Vale.X64.Instruction_s.InstrTypeRecord",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.opFlagsCf",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.op64",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_Add64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.rRax",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c
let test_inline_mov_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c
// This test generates the correct inline assembly code, but only works with gcc >= 9
// On prior versions, gcc ignores the register asm("rax") annotation, and does not correctly
// allocate the output "result" into register rax
(*
let test_inline_mov_add_input_dummy_mul () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Mul64 (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input_dummy_mul" (Some "result") args regs_mod c
*) | false | false | Vale.Test.TestInline.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 test_inline_comment_add: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_comment_add | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 74,
"end_line": 118,
"start_col": 52,
"start_line": 107
} |
FStar.All.ML | val test_inline_mov_mul_inputs: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_mov_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c | val test_inline_mov_mul_inputs: Prims.unit -> FStar.All.ML unit
let test_inline_mov_mul_inputs () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rRbx); ("second_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c =
Block
[
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx))
]
in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_IMul64",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRdx",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_mov_mul_inputs: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_mov_mul_inputs | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 77,
"end_line": 87,
"start_col": 55,
"start_line": 76
} |
FStar.All.ML | val test_inline_mov_mul_rax_100: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c | val test_inline_mov_mul_rax_100: Prims.unit -> FStar.All.ML unit
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rRbx)] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c =
Block
[
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx))
]
in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.OConst",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_IMul64",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRdx",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_mov_mul_rax_100: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_mov_mul_rax_100 | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 78,
"end_line": 74,
"start_col": 56,
"start_line": 64
} |
FStar.All.ML | val test_inline_same_line_newline: Prims.unit -> FStar.All.ML unit | [
{
"abbrev": false,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IO",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test",
"short_module": null
},
{
"abbrev": 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 test_inline_same_line_newline () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let c = Block [
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr_annotate ins_Newline (AnnotateNewline ()));
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rRax));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_same_line_newline" (Some "result") args regs_mod c | val test_inline_same_line_newline: Prims.unit -> FStar.All.ML unit
let test_inline_same_line_newline () : FStar.All.ML unit = | true | null | false | let args = [("first_arg", TD_Base TUInt64, rR15)] in
let regs_mod r = (r = rR15 || r = rRax) in
let c =
Block
[
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr_annotate ins_Newline (AnnotateNewline ()));
Ins (make_instr_annotate (ins_Space 4) (AnnotateSpace 4));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rRax));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15))
]
in
print_function "test_inline_same_line_newline" (Some "result") args regs_mod c | {
"checked_file": "Vale.Test.TestInline.fst.checked",
"dependencies": [
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instructions_s.fsti.checked",
"Vale.X64.InsLemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Test.TestInline.fst"
} | [
"ml"
] | [
"Prims.unit",
"Vale.Test.TestInline.print_function",
"FStar.Pervasives.Native.Some",
"Prims.string",
"Vale.X64.Machine_s.precode",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Machine_s.Block",
"Prims.Cons",
"Vale.X64.Machine_s.Ins",
"Vale.X64.InsLemmas.make_instr_annotate",
"Prims.Nil",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.PreserveFlags",
"Vale.X64.Instructions_s.ins_Space",
"Vale.X64.Machine_Semantics_s.AnnotateSpace",
"Vale.X64.Instruction_s.InstrTypeRecord",
"Vale.X64.InsLemmas.make_instr",
"Vale.X64.Instruction_s.out",
"Vale.X64.Instruction_s.op64",
"Vale.X64.Instructions_s.ins_Mov64",
"Vale.X64.Machine_s.OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rR15",
"Vale.X64.Instruction_s.opFlagsCf",
"Vale.X64.Instruction_s.inOut",
"Vale.X64.Instruction_s.HavocFlags",
"Vale.X64.Instructions_s.ins_Add64",
"Vale.X64.Instructions_s.ins_Newline",
"Vale.X64.Machine_Semantics_s.AnnotateNewline",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.list",
"FStar.Pervasives.Native.tuple3",
"Vale.Interop.Base.td",
"FStar.Pervasives.Native.Mktuple3",
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Test.TestInline
open FStar.Mul
open FStar.IO
open Vale.Arch.HeapTypes_s
open Vale.X64.Machine_s
open Vale.X64.Instructions_s
open Vale.X64.Bytes_Code_s
open Vale.X64.Machine_Semantics_s
open Vale.X64.InsLemmas
open Vale.Interop.Base
open Vale.Interop.X64
open Vale.X64.Print_Inline_s
let print_function
(name:string)
(ret_val:option string)
(args:list (string & td & reg_64))
(regs_mod:reg_64 -> bool)
(c:code)
: FStar.All.ML unit
=
let len = List.length args in
let arg_names n = match List.Tot.nth args n with None -> "" | Some (x, _, _) -> x in
let arg_types = List.Tot.map (fun (_, t, _) -> t) args in
let arg_regs (n:reg_nat len) : reg_64 =
match List.Tot.nth args n with None -> 0 | Some (_, _, r) -> r
in
let _ = print_inline name 0 ret_val len arg_types arg_names c arg_regs regs_mod [] in
()
let test_inline_mov_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mov_input" (Some "result") args regs_mod c
let test_inline_mov_add_input () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input" (Some "result") args regs_mod c
let test_inline_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_mul_inputs" (Some "result") args regs_mod c
let test_inline_mov_mul_rax_100 () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OConst 100));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_rax_100" (Some "result") args regs_mod c
let test_inline_mov_mul_inputs () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rRbx);
("second_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRcx || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rRbx));
Ins (make_instr ins_Mov64 (OReg rRcx) (OReg rR15));
Ins (make_instr ins_IMul64 (OReg rRax) (OReg rRcx));
] in
print_function "test_inline_mov_mul_inputs" (Some "result") args regs_mod c
// This test generates the correct inline assembly code, but only works with gcc >= 9
// On prior versions, gcc ignores the register asm("rax") annotation, and does not correctly
// allocate the output "result" into register rax
(*
let test_inline_mov_add_input_dummy_mul () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rRax || r = rRdx) in
let c = Block [
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Mul64 (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));
] in
print_function "test_inline_mov_add_input_dummy_mul" (Some "result") args regs_mod c
*)
let test_inline_comment_add () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let s = "This is a comment" in
let c = Block [
Ins (make_instr_annotate (ins_Comment s) (AnnotateComment s));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_comment_add" (Some "result") args regs_mod c
let test_inline_same_line () : FStar.All.ML unit =
let args = [
("first_arg", TD_Base TUInt64, rR15);
] in
let regs_mod r = (r = rR15 || r = rRax) in
let c = Block [
Ins (make_instr_annotate (ins_Space 0) (AnnotateSpace 0));
Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));
Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));
] in
print_function "test_inline_same_line" (Some "result") args regs_mod c | false | false | Vale.Test.TestInline.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 test_inline_same_line_newline: Prims.unit -> FStar.All.ML unit | [] | Vale.Test.TestInline.test_inline_same_line_newline | {
"file_name": "vale/code/test/Vale.Test.TestInline.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ML Prims.unit | {
"end_col": 80,
"end_line": 146,
"start_col": 58,
"start_line": 132
} |
FStar.Pervasives.Lemma | val lemma_set_to_one_reverse_equality (q0 q1: quad32)
: Lemma (requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1)) | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": 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 lemma_set_to_one_reverse_equality (q0 q1:quad32) : Lemma
(requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1))
=
reveal_reverse_bytes_quad32 q0;
reveal_reverse_bytes_quad32 q1;
() | val lemma_set_to_one_reverse_equality (q0 q1: quad32)
: Lemma (requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1))
let lemma_set_to_one_reverse_equality (q0 q1: quad32)
: Lemma (requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1)) = | false | null | true | reveal_reverse_bytes_quad32 q0;
reveal_reverse_bytes_quad32 q1;
() | {
"checked_file": "Vale.AES.GCM.fst.checked",
"dependencies": [
"Vale.Lib.Seqs.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.GCM.fst"
} | [
"lemma"
] | [
"Vale.Def.Types_s.quad32",
"Prims.unit",
"Vale.Def.Types_s.reveal_reverse_bytes_quad32",
"Prims.b2t",
"Vale.AES.GCM.lower3_equal",
"Prims.squash",
"Prims.eq2",
"Vale.AES.GCM.set_to_one_LE",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.AES.GCM
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.AES.GCM_s
open Vale.AES.AES_s
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GHash_s
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Calc
open Vale.Def.Words.Four_s
let lemma_set_to_one_equality (q0 q1:quad32) : Lemma
(requires upper3_equal q0 q1)
(ensures set_to_one_LE q0 == set_to_one_LE q1)
=
()
let lemma_set_to_one_reverse_equality (q0 q1:quad32) : Lemma
(requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1)) | false | false | Vale.AES.GCM.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 lemma_set_to_one_reverse_equality (q0 q1: quad32)
: Lemma (requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1)) | [] | Vale.AES.GCM.lemma_set_to_one_reverse_equality | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCM.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q0: Vale.Def.Types_s.quad32 -> q1: Vale.Def.Types_s.quad32
-> FStar.Pervasives.Lemma (requires Vale.AES.GCM.lower3_equal q0 q1)
(ensures
Vale.AES.GCM.set_to_one_LE (Vale.Def.Types_s.reverse_bytes_quad32 q0) ==
Vale.AES.GCM.set_to_one_LE (Vale.Def.Types_s.reverse_bytes_quad32 q1)) | {
"end_col": 5,
"end_line": 32,
"start_col": 3,
"start_line": 30
} |
FStar.Pervasives.Lemma | val append_distributes_le_seq_quad32_to_bytes (x y: seq quad32)
: Lemma
(le_seq_quad32_to_bytes (append x y) ==
append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y)) | [
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": 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 append_distributes_le_seq_quad32_to_bytes (x y:seq quad32) :
Lemma (le_seq_quad32_to_bytes (append x y) == append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y))
=
append_distributes_le_seq_quad32_to_bytes x y | val append_distributes_le_seq_quad32_to_bytes (x y: seq quad32)
: Lemma
(le_seq_quad32_to_bytes (append x y) ==
append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y))
let append_distributes_le_seq_quad32_to_bytes (x y: seq quad32)
: Lemma
(le_seq_quad32_to_bytes (append x y) ==
append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y)) = | false | null | true | append_distributes_le_seq_quad32_to_bytes x y | {
"checked_file": "Vale.AES.GCM.fst.checked",
"dependencies": [
"Vale.Lib.Seqs.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.GCM.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Arch.Types.append_distributes_le_seq_quad32_to_bytes",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.le_seq_quad32_to_bytes",
"FStar.Seq.Base.append",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.AES.GCM
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.AES.GCM_s
open Vale.AES.AES_s
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GHash_s
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Calc
open Vale.Def.Words.Four_s
let lemma_set_to_one_equality (q0 q1:quad32) : Lemma
(requires upper3_equal q0 q1)
(ensures set_to_one_LE q0 == set_to_one_LE q1)
=
()
let lemma_set_to_one_reverse_equality (q0 q1:quad32) : Lemma
(requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1))
=
reveal_reverse_bytes_quad32 q0;
reveal_reverse_bytes_quad32 q1;
()
let lemma_le_bytes_to_quad32_prefix_equality (b0:seq nat8 {length b0 == 16}) (b1:seq nat8 {length b1 == 16}) : Lemma
(requires slice b0 0 12 == slice b1 0 12)
(ensures lower3_equal (le_bytes_to_quad32 b0) (le_bytes_to_quad32 b1))
=
let q0 = le_bytes_to_quad32 b0 in
let q1 = le_bytes_to_quad32 b1 in
le_bytes_to_quad32_reveal ();
(*
* AR: 06/25: Someone should review this code, is this proof supposed to work without revealing this?
*)
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (forall (i:int). (0 <= i /\ i < 12) ==> (index b0 i == index (slice b0 0 12) i /\
index b1 i == index (slice b1 0 12) i))
let lemma_le_seq_quad32_to_bytes_prefix_equality (q:quad32) : Lemma
(slice (le_quad32_to_bytes q) 0 12 == slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
=
assert (equal (slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
(slice (le_quad32_to_bytes q) 0 12));
()
let lemma_compute_iv_easy (iv_b iv_extra_b:seq quad32) (iv:supported_iv_LE) (num_bytes:nat64) (h_LE j0:quad32) : Lemma
(requires
length iv_extra_b == 1 /\
length iv_b * (128/8) <= num_bytes /\ num_bytes < length iv_b * (128/8) + 128/8 /\
num_bytes == 96/8 /\
(let iv_BE = reverse_bytes_quad32 (index iv_extra_b 0) in
j0 == Mkfour 1 iv_BE.lo1 iv_BE.hi2 iv_BE.hi3) /\
(let raw_quads = append iv_b iv_extra_b in
let iv_bytes = slice (le_seq_quad32_to_bytes raw_quads) 0 num_bytes in
iv_bytes == iv))
(ensures j0 == compute_iv_BE h_LE iv)
=
assert (length iv == 12);
assert (length iv_b == 0);
lemma_empty iv_b;
append_empty_l iv_extra_b;
assert (append iv_b iv_extra_b == iv_extra_b);
let q = index iv_extra_b 0 in
le_seq_quad32_to_bytes_of_singleton q;
assert (equal iv_extra_b (create 1 q));
assert (le_seq_quad32_to_bytes iv_extra_b == le_quad32_to_bytes q);
// Prove this so we can call lemma_le_bytes_to_quad32_prefix_equality below
calc (==) {
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12;
== {}
slice (pad_to_128_bits iv) 0 12;
};
// Prove this so we can call lemma_set_to_one_reverse_equality below
calc (==) {
le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 num_bytes));
== {}
le_bytes_to_quad32 (pad_to_128_bits (slice (le_seq_quad32_to_bytes iv_extra_b) 0 num_bytes));
== {}
le_bytes_to_quad32 (pad_to_128_bits iv);
};
calc (==) {
j0;
== {}
set_to_one_LE (reverse_bytes_quad32 q);
== { le_bytes_to_quad32_to_bytes q }
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (le_quad32_to_bytes q)));
== {
lemma_le_seq_quad32_to_bytes_prefix_equality q;
lemma_le_bytes_to_quad32_prefix_equality
(le_quad32_to_bytes q)
(pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12));
lemma_set_to_one_reverse_equality
(le_bytes_to_quad32 (le_quad32_to_bytes q))
(le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)))
}
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12))));
== { lemma_set_to_one_reverse_equality
(le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)))
(le_bytes_to_quad32 (pad_to_128_bits iv));
lemma_le_bytes_to_quad32_prefix_equality
(pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12))
(pad_to_128_bits iv) }
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (pad_to_128_bits iv)));
== {compute_iv_BE_reveal ()}
compute_iv_BE h_LE iv;
};
()
open Vale.AES.GHash
let lemma_compute_iv_hard (iv:supported_iv_LE) (quads:seq quad32) (length_quad h_LE j0:quad32) : Lemma
(requires
~(length iv == 96/8) /\
quads == le_bytes_to_seq_quad32 (pad_to_128_bits iv) /\
j0 == ghash_incremental h_LE (Mkfour 0 0 0 0) (append quads (create 1 length_quad)) /\
length_quad == reverse_bytes_quad32 (insert_nat64
(insert_nat64
(Mkfour 0 0 0 0) 0 1)
(8 * (length iv)) 0))
(ensures reverse_bytes_quad32 j0 == compute_iv_BE h_LE iv)
=
assert (two_to_nat32 (Mktwo 0 0) == 0);
let q0 = Mkfour 0 0 0 0 in
lemma_insert_nat64_nat32s q0 0 0;
assert (insert_nat64 q0 0 1 == q0);
insert_nat64_reveal ();
assert (length_quad == reverse_bytes_quad32 (insert_nat64_def (Mkfour 0 0 0 0) (8 * length iv) 0));
ghash_incremental_to_ghash h_LE (append quads (create 1 length_quad));
compute_iv_BE_reveal ();
()
let gcm_encrypt_LE_fst_helper (iv:supported_iv_LE) (iv_enc iv_BE:quad32) (plain auth cipher:seq nat8) (alg:algorithm) (key:seq nat32) : Lemma
(requires
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
iv_enc == inc32 (compute_iv_BE h_LE iv) 1 /\
cipher == gctr_encrypt_LE iv_enc (make_gctr_plain_LE plain) alg key /\
length plain < pow2_32 /\
length auth < pow2_32
))
(ensures cipher == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth))
=
gcm_encrypt_LE_reveal ()
(*
let s_key_LE = seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE key) in
let s_iv_BE = be_bytes_to_quad32 (be_quad32_to_bytes iv_BE) in
let s_j0_BE = Mkfour 1 s_iv_BE.lo1 s_iv_BE.hi2 s_iv_BE.hi3 in
let s_cipher = fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) (be_quad32_to_bytes iv_BE) plain auth) in
be_bytes_to_quad32_to_bytes iv_BE;
assert (s_cipher == gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg s_key_LE);
assert (s_iv_BE == iv_BE);
assert (s_key_LE == key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg s_key_LE ==
gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg key ==
gctr_encrypt_LE (inc32 s_j0_BE 1) (make_gctr_plain_LE plain) alg key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) (make_gctr_plain_LE plain) alg key ==
gctr_encrypt_LE iv_enc (make_gctr_plain_LE plain) alg key);
()
*)
let gcm_encrypt_LE_snd_helper (iv:supported_iv_LE) (j0_BE length_quad32 hash mac:quad32) (plain auth cipher:seq nat8) (alg:algorithm) (key:seq nat32) : Lemma
(requires
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
j0_BE = compute_iv_BE h_LE iv /\
length plain < pow2_32 /\
length auth < pow2_32 /\
cipher == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth) /\
length_quad32 == reverse_bytes_quad32
(insert_nat64 (insert_nat64 (Mkfour 0 0 0 0) (8 * length auth) 1) (8 * length plain) 0) /\
(let auth_padded_quads = le_bytes_to_seq_quad32 (pad_to_128_bits auth) in
let cipher_padded_quads = le_bytes_to_seq_quad32 (pad_to_128_bits cipher) in
hash == ghash_LE h_LE (append auth_padded_quads (append cipher_padded_quads (create 1 length_quad32))) /\
le_quad32_to_bytes mac == gctr_encrypt_LE j0_BE (le_quad32_to_bytes hash) alg key)
))
(ensures le_quad32_to_bytes mac == snd (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth))
=
insert_nat64_reveal ();
gcm_encrypt_LE_reveal ()
//be_bytes_to_quad32_to_bytes iv_BE;
//let t = snd (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) (be_quad32_to_bytes iv_BE) plain auth) in
//()
#reset-options "--z3rlimit 10"
let gcm_blocks_helper_enc (alg:algorithm) (key:seq nat32)
(p128x6 p128 p_bytes c128x6 c128 c_bytes:seq quad32)
(auth_bytes:seq nat8)
(p_num_bytes:nat)
(iv:supported_iv_LE) (j0_BE:quad32) : Lemma
(requires // Required by gcm_blocks
length p128x6 * 16 + length p128 * 16 <= p_num_bytes /\
p_num_bytes < length p128x6 * 16 + length p128 * 16 + 16 /\
length p128x6 == length c128x6 /\
length p128 == length c128 /\
length p_bytes == 1 /\
length c_bytes == 1 /\
(length auth_bytes) < pow2_32 /\
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
j0_BE = compute_iv_BE h_LE iv /\
// Ensured by gcm_blocks
p_num_bytes < pow2_32 /\
(let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let cipher_bound:nat = length p128x6 + length p128 +
(if p_num_bytes > (length p128x6 + length p128) * 16 then 1 else 0)
in
gctr_partial alg cipher_bound plain cipher key ctr_BE_2
)))
(ensures (let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
//cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key))
cipher_bytes == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes)))
=
let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let cipher_bound:nat = length p128x6 + length p128 +
(if p_num_bytes > (length p128x6 + length p128) * 16 then 1 else 0)
in
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
gctr_partial_opaque_completed alg plain cipher key ctr_BE_2;
if p_num_bytes > (length p128x6 + length p128) * 16 then (
gctr_partial_reveal ();
assert (gctr_partial alg (length p128x6 + length p128) plain cipher key ctr_BE_2);
assert (equal (slice plain 0 (length p128x6 + length p128))
(slice (append p128x6 p128) 0 (length p128x6 + length p128)));
assert (equal (slice cipher 0 (length p128x6 + length p128))
(slice (append c128x6 c128) 0 (length p128x6 + length p128)));
gctr_partial_opaque_ignores_postfix
alg (length p128x6 + length p128)
plain (append p128x6 p128)
cipher (append c128x6 c128)
key ctr_BE_2;
assert (gctr_partial alg (length p128x6 + length p128) (append p128x6 p128) (append c128x6 c128) key ctr_BE_2);
gctr_partial_opaque_completed alg (append p128x6 p128) (append c128x6 c128) key ctr_BE_2;
let num_blocks = p_num_bytes / 16 in
assert(index cipher num_blocks == quad32_xor (index plain num_blocks) (aes_encrypt_BE alg key (inc32 ctr_BE_2 num_blocks)));
gctr_encrypt_block_offset ctr_BE_2 (index plain num_blocks) alg key num_blocks;
assert( gctr_encrypt_block ctr_BE_2 (index plain num_blocks) alg key num_blocks ==
gctr_encrypt_block (inc32 ctr_BE_2 num_blocks) (index plain num_blocks) alg key 0);
aes_encrypt_LE_reveal ();
gctr_partial_to_full_advanced ctr_BE_2 plain cipher alg key p_num_bytes;
assert (cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key)
) else (
gctr_partial_to_full_basic ctr_BE_2 plain alg key cipher;
assert (le_seq_quad32_to_bytes cipher == gctr_encrypt_LE ctr_BE_2 (le_seq_quad32_to_bytes plain) alg key);
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
assert (equal plain_bytes (le_seq_quad32_to_bytes plain));
assert (equal cipher_bytes (le_seq_quad32_to_bytes cipher));
assert (cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key)
);
gcm_encrypt_LE_fst_helper iv ctr_BE_2 j0_BE plain_bytes auth_bytes cipher_bytes alg key;
()
let slice_append_back (#a:Type) (x y:seq a) (i:nat) : Lemma
(requires length x <= i /\ i <= length x + length y)
(ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))
=
assert (equal (slice (append x y) 0 i) (append x (slice y 0 (i - length x))));
()
let append_distributes_le_seq_quad32_to_bytes (x y:seq quad32) :
Lemma (le_seq_quad32_to_bytes (append x y) == append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y)) | false | false | Vale.AES.GCM.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": 10,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val append_distributes_le_seq_quad32_to_bytes (x y: seq quad32)
: Lemma
(le_seq_quad32_to_bytes (append x y) ==
append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y)) | [] | Vale.AES.GCM.append_distributes_le_seq_quad32_to_bytes | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCM.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> y: FStar.Seq.Base.seq Vale.Def.Types_s.quad32
-> FStar.Pervasives.Lemma
(ensures
Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append x y) ==
FStar.Seq.Base.append (Vale.Def.Types_s.le_seq_quad32_to_bytes x)
(Vale.Def.Types_s.le_seq_quad32_to_bytes y)) | {
"end_col": 47,
"end_line": 324,
"start_col": 2,
"start_line": 324
} |
FStar.Pervasives.Lemma | val pad_to_128_bits_multiple_append (x y: seq nat8)
: Lemma (requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y)) | [
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": 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 pad_to_128_bits_multiple_append (x y:seq nat8) : Lemma
(requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y))
=
assert (equal (pad_to_128_bits (append x y)) (append x (pad_to_128_bits y))) | val pad_to_128_bits_multiple_append (x y: seq nat8)
: Lemma (requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y))
let pad_to_128_bits_multiple_append (x y: seq nat8)
: Lemma (requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y)) = | false | null | true | assert (equal (pad_to_128_bits (append x y)) (append x (pad_to_128_bits y))) | {
"checked_file": "Vale.AES.GCM.fst.checked",
"dependencies": [
"Vale.Lib.Seqs.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.GCM.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat8",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Types_s.nat8",
"Vale.AES.GCTR_s.pad_to_128_bits",
"FStar.Seq.Base.append",
"Prims.unit",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.AES.GCM
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.AES.GCM_s
open Vale.AES.AES_s
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GHash_s
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Calc
open Vale.Def.Words.Four_s
let lemma_set_to_one_equality (q0 q1:quad32) : Lemma
(requires upper3_equal q0 q1)
(ensures set_to_one_LE q0 == set_to_one_LE q1)
=
()
let lemma_set_to_one_reverse_equality (q0 q1:quad32) : Lemma
(requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1))
=
reveal_reverse_bytes_quad32 q0;
reveal_reverse_bytes_quad32 q1;
()
let lemma_le_bytes_to_quad32_prefix_equality (b0:seq nat8 {length b0 == 16}) (b1:seq nat8 {length b1 == 16}) : Lemma
(requires slice b0 0 12 == slice b1 0 12)
(ensures lower3_equal (le_bytes_to_quad32 b0) (le_bytes_to_quad32 b1))
=
let q0 = le_bytes_to_quad32 b0 in
let q1 = le_bytes_to_quad32 b1 in
le_bytes_to_quad32_reveal ();
(*
* AR: 06/25: Someone should review this code, is this proof supposed to work without revealing this?
*)
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (forall (i:int). (0 <= i /\ i < 12) ==> (index b0 i == index (slice b0 0 12) i /\
index b1 i == index (slice b1 0 12) i))
let lemma_le_seq_quad32_to_bytes_prefix_equality (q:quad32) : Lemma
(slice (le_quad32_to_bytes q) 0 12 == slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
=
assert (equal (slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
(slice (le_quad32_to_bytes q) 0 12));
()
let lemma_compute_iv_easy (iv_b iv_extra_b:seq quad32) (iv:supported_iv_LE) (num_bytes:nat64) (h_LE j0:quad32) : Lemma
(requires
length iv_extra_b == 1 /\
length iv_b * (128/8) <= num_bytes /\ num_bytes < length iv_b * (128/8) + 128/8 /\
num_bytes == 96/8 /\
(let iv_BE = reverse_bytes_quad32 (index iv_extra_b 0) in
j0 == Mkfour 1 iv_BE.lo1 iv_BE.hi2 iv_BE.hi3) /\
(let raw_quads = append iv_b iv_extra_b in
let iv_bytes = slice (le_seq_quad32_to_bytes raw_quads) 0 num_bytes in
iv_bytes == iv))
(ensures j0 == compute_iv_BE h_LE iv)
=
assert (length iv == 12);
assert (length iv_b == 0);
lemma_empty iv_b;
append_empty_l iv_extra_b;
assert (append iv_b iv_extra_b == iv_extra_b);
let q = index iv_extra_b 0 in
le_seq_quad32_to_bytes_of_singleton q;
assert (equal iv_extra_b (create 1 q));
assert (le_seq_quad32_to_bytes iv_extra_b == le_quad32_to_bytes q);
// Prove this so we can call lemma_le_bytes_to_quad32_prefix_equality below
calc (==) {
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12;
== {}
slice (pad_to_128_bits iv) 0 12;
};
// Prove this so we can call lemma_set_to_one_reverse_equality below
calc (==) {
le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 num_bytes));
== {}
le_bytes_to_quad32 (pad_to_128_bits (slice (le_seq_quad32_to_bytes iv_extra_b) 0 num_bytes));
== {}
le_bytes_to_quad32 (pad_to_128_bits iv);
};
calc (==) {
j0;
== {}
set_to_one_LE (reverse_bytes_quad32 q);
== { le_bytes_to_quad32_to_bytes q }
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (le_quad32_to_bytes q)));
== {
lemma_le_seq_quad32_to_bytes_prefix_equality q;
lemma_le_bytes_to_quad32_prefix_equality
(le_quad32_to_bytes q)
(pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12));
lemma_set_to_one_reverse_equality
(le_bytes_to_quad32 (le_quad32_to_bytes q))
(le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)))
}
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12))));
== { lemma_set_to_one_reverse_equality
(le_bytes_to_quad32 (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)))
(le_bytes_to_quad32 (pad_to_128_bits iv));
lemma_le_bytes_to_quad32_prefix_equality
(pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12))
(pad_to_128_bits iv) }
set_to_one_LE (reverse_bytes_quad32 (le_bytes_to_quad32 (pad_to_128_bits iv)));
== {compute_iv_BE_reveal ()}
compute_iv_BE h_LE iv;
};
()
open Vale.AES.GHash
let lemma_compute_iv_hard (iv:supported_iv_LE) (quads:seq quad32) (length_quad h_LE j0:quad32) : Lemma
(requires
~(length iv == 96/8) /\
quads == le_bytes_to_seq_quad32 (pad_to_128_bits iv) /\
j0 == ghash_incremental h_LE (Mkfour 0 0 0 0) (append quads (create 1 length_quad)) /\
length_quad == reverse_bytes_quad32 (insert_nat64
(insert_nat64
(Mkfour 0 0 0 0) 0 1)
(8 * (length iv)) 0))
(ensures reverse_bytes_quad32 j0 == compute_iv_BE h_LE iv)
=
assert (two_to_nat32 (Mktwo 0 0) == 0);
let q0 = Mkfour 0 0 0 0 in
lemma_insert_nat64_nat32s q0 0 0;
assert (insert_nat64 q0 0 1 == q0);
insert_nat64_reveal ();
assert (length_quad == reverse_bytes_quad32 (insert_nat64_def (Mkfour 0 0 0 0) (8 * length iv) 0));
ghash_incremental_to_ghash h_LE (append quads (create 1 length_quad));
compute_iv_BE_reveal ();
()
let gcm_encrypt_LE_fst_helper (iv:supported_iv_LE) (iv_enc iv_BE:quad32) (plain auth cipher:seq nat8) (alg:algorithm) (key:seq nat32) : Lemma
(requires
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
iv_enc == inc32 (compute_iv_BE h_LE iv) 1 /\
cipher == gctr_encrypt_LE iv_enc (make_gctr_plain_LE plain) alg key /\
length plain < pow2_32 /\
length auth < pow2_32
))
(ensures cipher == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth))
=
gcm_encrypt_LE_reveal ()
(*
let s_key_LE = seq_nat8_to_seq_nat32_LE (seq_nat32_to_seq_nat8_LE key) in
let s_iv_BE = be_bytes_to_quad32 (be_quad32_to_bytes iv_BE) in
let s_j0_BE = Mkfour 1 s_iv_BE.lo1 s_iv_BE.hi2 s_iv_BE.hi3 in
let s_cipher = fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) (be_quad32_to_bytes iv_BE) plain auth) in
be_bytes_to_quad32_to_bytes iv_BE;
assert (s_cipher == gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg s_key_LE);
assert (s_iv_BE == iv_BE);
assert (s_key_LE == key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg s_key_LE ==
gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) plain alg key ==
gctr_encrypt_LE (inc32 s_j0_BE 1) (make_gctr_plain_LE plain) alg key);
assert (gctr_encrypt_LE (inc32 s_j0_BE 1) (make_gctr_plain_LE plain) alg key ==
gctr_encrypt_LE iv_enc (make_gctr_plain_LE plain) alg key);
()
*)
let gcm_encrypt_LE_snd_helper (iv:supported_iv_LE) (j0_BE length_quad32 hash mac:quad32) (plain auth cipher:seq nat8) (alg:algorithm) (key:seq nat32) : Lemma
(requires
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
j0_BE = compute_iv_BE h_LE iv /\
length plain < pow2_32 /\
length auth < pow2_32 /\
cipher == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth) /\
length_quad32 == reverse_bytes_quad32
(insert_nat64 (insert_nat64 (Mkfour 0 0 0 0) (8 * length auth) 1) (8 * length plain) 0) /\
(let auth_padded_quads = le_bytes_to_seq_quad32 (pad_to_128_bits auth) in
let cipher_padded_quads = le_bytes_to_seq_quad32 (pad_to_128_bits cipher) in
hash == ghash_LE h_LE (append auth_padded_quads (append cipher_padded_quads (create 1 length_quad32))) /\
le_quad32_to_bytes mac == gctr_encrypt_LE j0_BE (le_quad32_to_bytes hash) alg key)
))
(ensures le_quad32_to_bytes mac == snd (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain auth))
=
insert_nat64_reveal ();
gcm_encrypt_LE_reveal ()
//be_bytes_to_quad32_to_bytes iv_BE;
//let t = snd (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) (be_quad32_to_bytes iv_BE) plain auth) in
//()
#reset-options "--z3rlimit 10"
let gcm_blocks_helper_enc (alg:algorithm) (key:seq nat32)
(p128x6 p128 p_bytes c128x6 c128 c_bytes:seq quad32)
(auth_bytes:seq nat8)
(p_num_bytes:nat)
(iv:supported_iv_LE) (j0_BE:quad32) : Lemma
(requires // Required by gcm_blocks
length p128x6 * 16 + length p128 * 16 <= p_num_bytes /\
p_num_bytes < length p128x6 * 16 + length p128 * 16 + 16 /\
length p128x6 == length c128x6 /\
length p128 == length c128 /\
length p_bytes == 1 /\
length c_bytes == 1 /\
(length auth_bytes) < pow2_32 /\
is_aes_key_LE alg key /\
(let h_LE = aes_encrypt_LE alg key (Mkfour 0 0 0 0) in
j0_BE = compute_iv_BE h_LE iv /\
// Ensured by gcm_blocks
p_num_bytes < pow2_32 /\
(let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let cipher_bound:nat = length p128x6 + length p128 +
(if p_num_bytes > (length p128x6 + length p128) * 16 then 1 else 0)
in
gctr_partial alg cipher_bound plain cipher key ctr_BE_2
)))
(ensures (let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
//cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key))
cipher_bytes == fst (gcm_encrypt_LE alg (seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes)))
=
let ctr_BE_2:quad32 = inc32 j0_BE 1 in
let plain:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append p128x6 p128) p_bytes
else
append p128x6 p128
in
let cipher:seq quad32 =
if p_num_bytes > (length p128x6 + length p128) * 16 then
append (append c128x6 c128) c_bytes
else
append c128x6 c128
in
let cipher_bound:nat = length p128x6 + length p128 +
(if p_num_bytes > (length p128x6 + length p128) * 16 then 1 else 0)
in
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
gctr_partial_opaque_completed alg plain cipher key ctr_BE_2;
if p_num_bytes > (length p128x6 + length p128) * 16 then (
gctr_partial_reveal ();
assert (gctr_partial alg (length p128x6 + length p128) plain cipher key ctr_BE_2);
assert (equal (slice plain 0 (length p128x6 + length p128))
(slice (append p128x6 p128) 0 (length p128x6 + length p128)));
assert (equal (slice cipher 0 (length p128x6 + length p128))
(slice (append c128x6 c128) 0 (length p128x6 + length p128)));
gctr_partial_opaque_ignores_postfix
alg (length p128x6 + length p128)
plain (append p128x6 p128)
cipher (append c128x6 c128)
key ctr_BE_2;
assert (gctr_partial alg (length p128x6 + length p128) (append p128x6 p128) (append c128x6 c128) key ctr_BE_2);
gctr_partial_opaque_completed alg (append p128x6 p128) (append c128x6 c128) key ctr_BE_2;
let num_blocks = p_num_bytes / 16 in
assert(index cipher num_blocks == quad32_xor (index plain num_blocks) (aes_encrypt_BE alg key (inc32 ctr_BE_2 num_blocks)));
gctr_encrypt_block_offset ctr_BE_2 (index plain num_blocks) alg key num_blocks;
assert( gctr_encrypt_block ctr_BE_2 (index plain num_blocks) alg key num_blocks ==
gctr_encrypt_block (inc32 ctr_BE_2 num_blocks) (index plain num_blocks) alg key 0);
aes_encrypt_LE_reveal ();
gctr_partial_to_full_advanced ctr_BE_2 plain cipher alg key p_num_bytes;
assert (cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key)
) else (
gctr_partial_to_full_basic ctr_BE_2 plain alg key cipher;
assert (le_seq_quad32_to_bytes cipher == gctr_encrypt_LE ctr_BE_2 (le_seq_quad32_to_bytes plain) alg key);
let plain_bytes = slice (le_seq_quad32_to_bytes plain) 0 p_num_bytes in
let cipher_bytes = slice (le_seq_quad32_to_bytes cipher) 0 p_num_bytes in
assert (equal plain_bytes (le_seq_quad32_to_bytes plain));
assert (equal cipher_bytes (le_seq_quad32_to_bytes cipher));
assert (cipher_bytes == gctr_encrypt_LE ctr_BE_2 plain_bytes alg key)
);
gcm_encrypt_LE_fst_helper iv ctr_BE_2 j0_BE plain_bytes auth_bytes cipher_bytes alg key;
()
let slice_append_back (#a:Type) (x y:seq a) (i:nat) : Lemma
(requires length x <= i /\ i <= length x + length y)
(ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))
=
assert (equal (slice (append x y) 0 i) (append x (slice y 0 (i - length x))));
()
let append_distributes_le_seq_quad32_to_bytes (x y:seq quad32) :
Lemma (le_seq_quad32_to_bytes (append x y) == append (le_seq_quad32_to_bytes x) (le_seq_quad32_to_bytes y))
=
append_distributes_le_seq_quad32_to_bytes x y
let pad_to_128_bits_multiple_append (x y:seq nat8) : Lemma
(requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y)) | false | false | Vale.AES.GCM.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": 10,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad_to_128_bits_multiple_append (x y: seq nat8)
: Lemma (requires length x % 16 == 0)
(ensures pad_to_128_bits (append x y) == append x (pad_to_128_bits y)) | [] | Vale.AES.GCM.pad_to_128_bits_multiple_append | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCM.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.Seq.Base.seq Vale.Def.Words_s.nat8 -> y: FStar.Seq.Base.seq Vale.Def.Words_s.nat8
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length x % 16 == 0)
(ensures
Vale.AES.GCTR_s.pad_to_128_bits (FStar.Seq.Base.append x y) ==
FStar.Seq.Base.append x (Vale.AES.GCTR_s.pad_to_128_bits y)) | {
"end_col": 78,
"end_line": 330,
"start_col": 2,
"start_line": 330
} |
FStar.Pervasives.Lemma | val lemma_le_seq_quad32_to_bytes_prefix_equality (q: quad32)
: Lemma
(slice (le_quad32_to_bytes q) 0 12 ==
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12) | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Calc",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": 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 lemma_le_seq_quad32_to_bytes_prefix_equality (q:quad32) : Lemma
(slice (le_quad32_to_bytes q) 0 12 == slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
=
assert (equal (slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
(slice (le_quad32_to_bytes q) 0 12));
() | val lemma_le_seq_quad32_to_bytes_prefix_equality (q: quad32)
: Lemma
(slice (le_quad32_to_bytes q) 0 12 ==
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
let lemma_le_seq_quad32_to_bytes_prefix_equality (q: quad32)
: Lemma
(slice (le_quad32_to_bytes q) 0 12 ==
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12) = | false | null | true | assert (equal (slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12)
(slice (le_quad32_to_bytes q) 0 12));
() | {
"checked_file": "Vale.AES.GCM.fst.checked",
"dependencies": [
"Vale.Lib.Seqs.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.GCM.fst"
} | [
"lemma"
] | [
"Vale.Def.Types_s.quad32",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Vale.Def.Types_s.nat8",
"FStar.Seq.Base.slice",
"Vale.AES.GCTR_s.pad_to_128_bits",
"Vale.Def.Types_s.le_quad32_to_bytes",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.AES.GCM
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.AES.GCM_s
open Vale.AES.AES_s
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GHash_s
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Calc
open Vale.Def.Words.Four_s
let lemma_set_to_one_equality (q0 q1:quad32) : Lemma
(requires upper3_equal q0 q1)
(ensures set_to_one_LE q0 == set_to_one_LE q1)
=
()
let lemma_set_to_one_reverse_equality (q0 q1:quad32) : Lemma
(requires lower3_equal q0 q1)
(ensures set_to_one_LE (reverse_bytes_quad32 q0) == set_to_one_LE (reverse_bytes_quad32 q1))
=
reveal_reverse_bytes_quad32 q0;
reveal_reverse_bytes_quad32 q1;
()
let lemma_le_bytes_to_quad32_prefix_equality (b0:seq nat8 {length b0 == 16}) (b1:seq nat8 {length b1 == 16}) : Lemma
(requires slice b0 0 12 == slice b1 0 12)
(ensures lower3_equal (le_bytes_to_quad32 b0) (le_bytes_to_quad32 b1))
=
let q0 = le_bytes_to_quad32 b0 in
let q1 = le_bytes_to_quad32 b1 in
le_bytes_to_quad32_reveal ();
(*
* AR: 06/25: Someone should review this code, is this proof supposed to work without revealing this?
*)
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
assert (forall (i:int). (0 <= i /\ i < 12) ==> (index b0 i == index (slice b0 0 12) i /\
index b1 i == index (slice b1 0 12) i))
let lemma_le_seq_quad32_to_bytes_prefix_equality (q:quad32) : Lemma
(slice (le_quad32_to_bytes q) 0 12 == slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12) | false | false | Vale.AES.GCM.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 lemma_le_seq_quad32_to_bytes_prefix_equality (q: quad32)
: Lemma
(slice (le_quad32_to_bytes q) 0 12 ==
slice (pad_to_128_bits (slice (le_quad32_to_bytes q) 0 12)) 0 12) | [] | Vale.AES.GCM.lemma_le_seq_quad32_to_bytes_prefix_equality | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCM.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.slice (Vale.Def.Types_s.le_quad32_to_bytes q) 0 12 ==
FStar.Seq.Base.slice (Vale.AES.GCTR_s.pad_to_128_bits (FStar.Seq.Base.slice (Vale.Def.Types_s.le_quad32_to_bytes
q)
0
12))
0
12) | {
"end_col": 4,
"end_line": 55,
"start_col": 2,
"start_line": 53
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.