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 | val seq_of_bytes' (x: bytes32) (accu: Seq.seq byte)
: Tot (y: Seq.seq byte {y `Seq.equal` (accu `Seq.append` (B32.reveal x))})
(decreases (B32.length x)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 seq_of_bytes'
(x: bytes32)
(accu: Seq.seq byte)
: Tot (y: Seq.seq byte { y `Seq.equal` (accu `Seq.append` B32.reveal x) })
(decreases (B32.length x))
= if B32.len x = 0ul
then accu
else (seq_of_bytes' (B32.slice x 1ul (B32.len x)) (Seq.append accu (Seq.create 1 (B32.index x 0))) <: Seq.seq byte) | val seq_of_bytes' (x: bytes32) (accu: Seq.seq byte)
: Tot (y: Seq.seq byte {y `Seq.equal` (accu `Seq.append` (B32.reveal x))})
(decreases (B32.length x))
let rec seq_of_bytes' (x: bytes32) (accu: Seq.seq byte)
: Tot (y: Seq.seq byte {y `Seq.equal` (accu `Seq.append` (B32.reveal x))})
(decreases (B32.length x)) = | false | null | false | if B32.len x = 0ul
then accu
else
(seq_of_bytes' (B32.slice x 1ul (B32.len x)) (Seq.append accu (Seq.create 1 (B32.index x 0)))
<:
Seq.seq byte) | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total",
""
] | [
"LowParse.SLow.Base.bytes32",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"Prims.op_Equality",
"FStar.UInt32.t",
"FStar.Bytes.len",
"FStar.UInt32.__uint_to_t",
"Prims.bool",
"LowParse.SLow.Base.seq_of_bytes'",
"FStar.Bytes.slice",
"FStar.Seq.Base.append",
"FStar.Seq.Base.create",
"FStar.Bytes.index",
"FStar.Seq.Base.equal",
"FStar.Bytes.reveal"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y
let size32_postcond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
(y: U32.t)
: GTot Type0
= let sz = Seq.length (serialize s x) in
if sz > U32.v u32_max
then y == u32_max
else U32.v y == sz
[@unifier_hint_injective]
inline_for_extraction
let size32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (x: t) ->
Tot (y: U32.t {
size32_postcond s x y
})
let size32_constant_precond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
: GTot Type0
= k.parser_kind_high == Some k.parser_kind_low /\
U32.v len32 == k.parser_kind_low
inline_for_extraction
let size32_constant
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
(u: unit { size32_constant_precond s len32 } )
: Tot (size32 s)
= fun x ->
[@inline_let]
let (z: U32.t { size32_postcond s x z } ) = len32 in
z
inline_for_extraction
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
(* Total parsers for sequences *)
[@"opaque_to_smt"]
irreducible
let rec bytes_of_seq'
(x: Seq.seq byte)
(accu: bytes32 { B32.length accu + Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` (B32.reveal accu `Seq.append` x) })
(decreases (Seq.length x))
= if Seq.length x = 0
then accu
else bytes_of_seq' (Seq.tail x) (B32.append accu (B32.create 1ul (Seq.head x)))
[@"opaque_to_smt"]
inline_for_extraction
let bytes_of_seq
(x: Seq.seq byte { Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` x })
= bytes_of_seq' x B32.empty_bytes
inline_for_extraction
let parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p {
k.parser_kind_subkind == Some ParserStrong /\
begin match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296
end
})
(x: Seq.seq byte)
: Tot (y: _ { y == parse p x })
= match k.parser_kind_high with
| Some max ->
if Seq.length x < max
then
match p32 (bytes_of_seq x) with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
else begin
[@inline_let]
let max32 = U32.uint_to_t max in
let res = p32 (bytes_of_seq (Seq.slice x 0 max)) in
Classical.move_requires (parse_strong_prefix p x) (Seq.slice x 0 max);
Classical.move_requires (parse_strong_prefix p (Seq.slice x 0 max)) x;
parser_kind_prop_equiv k p;
match res with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
end
[@"opaque_to_smt"]
irreducible
let rec seq_of_bytes'
(x: bytes32)
(accu: Seq.seq byte)
: Tot (y: Seq.seq byte { y `Seq.equal` (accu `Seq.append` B32.reveal x) }) | false | false | LowParse.SLow.Base.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 seq_of_bytes' (x: bytes32) (accu: Seq.seq byte)
: Tot (y: Seq.seq byte {y `Seq.equal` (accu `Seq.append` (B32.reveal x))})
(decreases (B32.length x)) | [
"recursion"
] | LowParse.SLow.Base.seq_of_bytes' | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: LowParse.SLow.Base.bytes32 -> accu: FStar.Seq.Base.seq LowParse.Bytes.byte
-> Prims.Tot
(y:
FStar.Seq.Base.seq LowParse.Bytes.byte
{FStar.Seq.Base.equal y (FStar.Seq.Base.append accu (FStar.Bytes.reveal x))}) | {
"end_col": 117,
"end_line": 444,
"start_col": 2,
"start_line": 442
} |
Prims.Tot | val serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t)
: Tot (y: _{y == serialize s x}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t)
: Tot (y: _ { y == serialize s x })
= seq_of_bytes (s32 x) | val serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t)
: Tot (y: _{y == serialize s x})
let serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t)
: Tot (y: _{y == serialize s x}) = | false | null | false | seq_of_bytes (s32 x) | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.serializer32",
"LowParse.SLow.Base.seq_of_bytes",
"LowParse.Bytes.bytes",
"Prims.eq2",
"LowParse.Spec.Base.serialize"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y
let size32_postcond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
(y: U32.t)
: GTot Type0
= let sz = Seq.length (serialize s x) in
if sz > U32.v u32_max
then y == u32_max
else U32.v y == sz
[@unifier_hint_injective]
inline_for_extraction
let size32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (x: t) ->
Tot (y: U32.t {
size32_postcond s x y
})
let size32_constant_precond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
: GTot Type0
= k.parser_kind_high == Some k.parser_kind_low /\
U32.v len32 == k.parser_kind_low
inline_for_extraction
let size32_constant
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
(u: unit { size32_constant_precond s len32 } )
: Tot (size32 s)
= fun x ->
[@inline_let]
let (z: U32.t { size32_postcond s x z } ) = len32 in
z
inline_for_extraction
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
(* Total parsers for sequences *)
[@"opaque_to_smt"]
irreducible
let rec bytes_of_seq'
(x: Seq.seq byte)
(accu: bytes32 { B32.length accu + Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` (B32.reveal accu `Seq.append` x) })
(decreases (Seq.length x))
= if Seq.length x = 0
then accu
else bytes_of_seq' (Seq.tail x) (B32.append accu (B32.create 1ul (Seq.head x)))
[@"opaque_to_smt"]
inline_for_extraction
let bytes_of_seq
(x: Seq.seq byte { Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` x })
= bytes_of_seq' x B32.empty_bytes
inline_for_extraction
let parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p {
k.parser_kind_subkind == Some ParserStrong /\
begin match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296
end
})
(x: Seq.seq byte)
: Tot (y: _ { y == parse p x })
= match k.parser_kind_high with
| Some max ->
if Seq.length x < max
then
match p32 (bytes_of_seq x) with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
else begin
[@inline_let]
let max32 = U32.uint_to_t max in
let res = p32 (bytes_of_seq (Seq.slice x 0 max)) in
Classical.move_requires (parse_strong_prefix p x) (Seq.slice x 0 max);
Classical.move_requires (parse_strong_prefix p (Seq.slice x 0 max)) x;
parser_kind_prop_equiv k p;
match res with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
end
[@"opaque_to_smt"]
irreducible
let rec seq_of_bytes'
(x: bytes32)
(accu: Seq.seq byte)
: Tot (y: Seq.seq byte { y `Seq.equal` (accu `Seq.append` B32.reveal x) })
(decreases (B32.length x))
= if B32.len x = 0ul
then accu
else (seq_of_bytes' (B32.slice x 1ul (B32.len x)) (Seq.append accu (Seq.create 1 (B32.index x 0))) <: Seq.seq byte)
[@"opaque_to_smt"]
inline_for_extraction
let seq_of_bytes
(x: bytes32)
: Tot (y: Seq.seq byte { y `Seq.equal` B32.reveal x })
= seq_of_bytes' x Seq.empty
inline_for_extraction
let serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t) | false | false | LowParse.SLow.Base.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val serialize_tot_seq_of_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(s32: serializer32 s)
(x: t)
: Tot (y: _{y == serialize s x}) | [] | LowParse.SLow.Base.serialize_tot_seq_of_serializer32 | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | s32: LowParse.SLow.Base.serializer32 s -> x: t
-> y: LowParse.Bytes.bytes{y == LowParse.Spec.Base.serialize s x} | {
"end_col": 22,
"end_line": 462,
"start_col": 2,
"start_line": 462
} |
Prims.Tot | val bytes_of_seq' (x: Seq.seq byte) (accu: bytes32{B32.length accu + Seq.length x < 4294967296})
: Tot (y: bytes32{(B32.reveal y) `Seq.equal` ((B32.reveal accu) `Seq.append` x)})
(decreases (Seq.length x)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 bytes_of_seq'
(x: Seq.seq byte)
(accu: bytes32 { B32.length accu + Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` (B32.reveal accu `Seq.append` x) })
(decreases (Seq.length x))
= if Seq.length x = 0
then accu
else bytes_of_seq' (Seq.tail x) (B32.append accu (B32.create 1ul (Seq.head x))) | val bytes_of_seq' (x: Seq.seq byte) (accu: bytes32{B32.length accu + Seq.length x < 4294967296})
: Tot (y: bytes32{(B32.reveal y) `Seq.equal` ((B32.reveal accu) `Seq.append` x)})
(decreases (Seq.length x))
let rec bytes_of_seq' (x: Seq.seq byte) (accu: bytes32{B32.length accu + Seq.length x < 4294967296})
: Tot (y: bytes32{(B32.reveal y) `Seq.equal` ((B32.reveal accu) `Seq.append` x)})
(decreases (Seq.length x)) = | false | null | false | if Seq.length x = 0
then accu
else bytes_of_seq' (Seq.tail x) (B32.append accu (B32.create 1ul (Seq.head x))) | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total",
""
] | [
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"LowParse.SLow.Base.bytes32",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Bytes.length",
"FStar.Seq.Base.length",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"LowParse.SLow.Base.bytes_of_seq'",
"FStar.Seq.Properties.tail",
"FStar.Bytes.append",
"FStar.Bytes.create",
"FStar.UInt32.__uint_to_t",
"FStar.Seq.Properties.head",
"FStar.Seq.Base.equal",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Seq.Base.append"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y
let size32_postcond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
(y: U32.t)
: GTot Type0
= let sz = Seq.length (serialize s x) in
if sz > U32.v u32_max
then y == u32_max
else U32.v y == sz
[@unifier_hint_injective]
inline_for_extraction
let size32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (x: t) ->
Tot (y: U32.t {
size32_postcond s x y
})
let size32_constant_precond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
: GTot Type0
= k.parser_kind_high == Some k.parser_kind_low /\
U32.v len32 == k.parser_kind_low
inline_for_extraction
let size32_constant
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
(u: unit { size32_constant_precond s len32 } )
: Tot (size32 s)
= fun x ->
[@inline_let]
let (z: U32.t { size32_postcond s x z } ) = len32 in
z
inline_for_extraction
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
(* Total parsers for sequences *)
[@"opaque_to_smt"]
irreducible
let rec bytes_of_seq'
(x: Seq.seq byte)
(accu: bytes32 { B32.length accu + Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` (B32.reveal accu `Seq.append` x) }) | false | false | LowParse.SLow.Base.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 bytes_of_seq' (x: Seq.seq byte) (accu: bytes32{B32.length accu + Seq.length x < 4294967296})
: Tot (y: bytes32{(B32.reveal y) `Seq.equal` ((B32.reveal accu) `Seq.append` x)})
(decreases (Seq.length x)) | [
"recursion"
] | LowParse.SLow.Base.bytes_of_seq' | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
x: FStar.Seq.Base.seq LowParse.Bytes.byte ->
accu: LowParse.SLow.Base.bytes32{FStar.Bytes.length accu + FStar.Seq.Base.length x < 4294967296}
-> Prims.Tot
(y:
LowParse.SLow.Base.bytes32
{ FStar.Seq.Base.equal (FStar.Bytes.reveal y)
(FStar.Seq.Base.append (FStar.Bytes.reveal accu) x) }) | {
"end_col": 81,
"end_line": 393,
"start_col": 2,
"start_line": 391
} |
Prims.Pure | val add_overflow (x y: U32.t)
: Pure U32.t
(requires True)
(ensures
(fun z ->
if U32.v x + U32.v y > U32.v u32_max then z == u32_max else U32.v z == U32.v x + U32.v y
)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y | val add_overflow (x y: U32.t)
: Pure U32.t
(requires True)
(ensures
(fun z ->
if U32.v x + U32.v y > U32.v u32_max then z == u32_max else U32.v z == U32.v x + U32.v y
))
let add_overflow (x y: U32.t)
: Pure U32.t
(requires True)
(ensures
(fun z ->
if U32.v x + U32.v y > U32.v u32_max then z == u32_max else U32.v z == U32.v x + U32.v y
)) = | false | null | false | if U32.lt (U32.sub u32_max y) x then u32_max else U32.add x y | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [] | [
"FStar.UInt32.t",
"FStar.UInt32.lt",
"FStar.UInt32.sub",
"LowParse.SLow.Base.u32_max",
"Prims.bool",
"FStar.UInt32.add",
"Prims.l_True",
"Prims.op_GreaterThan",
"Prims.op_Addition",
"FStar.UInt32.v",
"Prims.eq2",
"Prims.int"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y | false | false | LowParse.SLow.Base.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 add_overflow (x y: U32.t)
: Pure U32.t
(requires True)
(ensures
(fun z ->
if U32.v x + U32.v y > U32.v u32_max then z == u32_max else U32.v z == U32.v x + U32.v y
)) | [] | LowParse.SLow.Base.add_overflow | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 18,
"end_line": 316,
"start_col": 2,
"start_line": 314
} |
Prims.Tot | val serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input | val serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2)) = | false | null | false | fun input -> s1' input | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.serializer32",
"Prims.squash",
"Prims.l_and",
"Prims.eq2",
"Prims.l_Forall",
"LowParse.Bytes.bytes",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"LowParse.SLow.Base.bytes32",
"LowParse.SLow.Base.serializer32_correct",
"LowParse.Spec.Base.serialize_ext"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input))) | false | false | LowParse.SLow.Base.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 serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2)) | [] | LowParse.SLow.Base.serialize32_ext | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p1: LowParse.Spec.Base.parser k1 t1 ->
s1: LowParse.Spec.Base.serializer p1 ->
s1': LowParse.SLow.Base.serializer32 s1 ->
p2: LowParse.Spec.Base.parser k2 t2 ->
u75:
Prims.squash (t1 == t2 /\
(forall (input: LowParse.Bytes.bytes).
LowParse.Spec.Base.parse p1 input == LowParse.Spec.Base.parse p2 input))
-> LowParse.SLow.Base.serializer32 (LowParse.Spec.Base.serialize_ext p1 s1 p2) | {
"end_col": 24,
"end_line": 161,
"start_col": 2,
"start_line": 161
} |
FStar.Pervasives.Lemma | val parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma (requires (p32 input == Some (v, consumed)))
(ensures
(B32.length (s32 v) == U32.v consumed /\ U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed))) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input | val parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma (requires (p32 input == Some (v, consumed)))
(ensures
(B32.length (s32 v) == U32.v consumed /\ U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)))
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma (requires (p32 input == Some (v, consumed)))
(ensures
(B32.length (s32 v) == U32.v consumed /\ U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed))) = | false | null | true | parser32_then_serializer32 s p32 s32 input | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"lemma"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.parser32",
"LowParse.SLow.Base.serializer32",
"LowParse.SLow.Base.bytes32",
"FStar.UInt32.t",
"LowParse.SLow.Base.parser32_then_serializer32",
"Prims.unit",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Prims.squash",
"Prims.l_and",
"FStar.UInt.uint_t",
"FStar.Bytes.length",
"FStar.UInt32.v",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.seq",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Seq.Base.slice",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed) | false | false | LowParse.SLow.Base.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 parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma (requires (p32 input == Some (v, consumed)))
(ensures
(B32.length (s32 v) == U32.v consumed /\ U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed))) | [] | LowParse.SLow.Base.parser32_then_serializer32' | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p32: LowParse.SLow.Base.parser32 p ->
s32: LowParse.SLow.Base.serializer32 s ->
input: LowParse.SLow.Base.bytes32 ->
v: t ->
consumed: FStar.UInt32.t
-> FStar.Pervasives.Lemma (requires p32 input == FStar.Pervasives.Native.Some (v, consumed))
(ensures
FStar.Bytes.length (s32 v) == FStar.UInt32.v consumed /\
FStar.UInt32.v consumed <= FStar.Bytes.length input /\
FStar.Bytes.reveal (s32 v) ==
FStar.Seq.Base.slice (FStar.Bytes.reveal input) 0 (FStar.UInt32.v consumed)) | {
"end_col": 44,
"end_line": 218,
"start_col": 2,
"start_line": 218
} |
Prims.Tot | val size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
= fun input -> s1' input | val size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2)) = | false | null | false | fun input -> s1' input | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.size32",
"Prims.squash",
"Prims.l_and",
"Prims.eq2",
"Prims.l_Forall",
"LowParse.Bytes.bytes",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"FStar.UInt32.t",
"LowParse.SLow.Base.size32_postcond",
"LowParse.Spec.Base.serialize_ext"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y
let size32_postcond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
(y: U32.t)
: GTot Type0
= let sz = Seq.length (serialize s x) in
if sz > U32.v u32_max
then y == u32_max
else U32.v y == sz
[@unifier_hint_injective]
inline_for_extraction
let size32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (x: t) ->
Tot (y: U32.t {
size32_postcond s x y
})
let size32_constant_precond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
: GTot Type0
= k.parser_kind_high == Some k.parser_kind_low /\
U32.v len32 == k.parser_kind_low
inline_for_extraction
let size32_constant
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
(u: unit { size32_constant_precond s len32 } )
: Tot (size32 s)
= fun x ->
[@inline_let]
let (z: U32.t { size32_postcond s x z } ) = len32 in
z
inline_for_extraction
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input))) | false | false | LowParse.SLow.Base.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 size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes). parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2)) | [] | LowParse.SLow.Base.size32_ext | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p1: LowParse.Spec.Base.parser k1 t1 ->
s1: LowParse.Spec.Base.serializer p1 ->
s1': LowParse.SLow.Base.size32 s1 ->
p2: LowParse.Spec.Base.parser k2 t2 ->
u159:
Prims.squash (t1 == t2 /\
(forall (input: LowParse.Bytes.bytes).
LowParse.Spec.Base.parse p1 input == LowParse.Spec.Base.parse p2 input))
-> LowParse.SLow.Base.size32 (LowParse.Spec.Base.serialize_ext p1 s1 p2) | {
"end_col": 24,
"end_line": 380,
"start_col": 2,
"start_line": 380
} |
FStar.Pervasives.Lemma | val parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma (requires (Some? (p32 input)))
(ensures
(let Some (v, consumed) = p32 input in
U32.v consumed <= B32.length input /\ s32 v == B32.b32slice input 0ul consumed)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s | val parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma (requires (Some? (p32 input)))
(ensures
(let Some (v, consumed) = p32 input in
U32.v consumed <= B32.length input /\ s32 v == B32.b32slice input 0ul consumed))
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma (requires (Some? (p32 input)))
(ensures
(let Some (v, consumed) = p32 input in
U32.v consumed <= B32.length input /\ s32 v == B32.b32slice input 0ul consumed)) = | false | null | true | serializer_correct_implies_complete p s | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"lemma"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.parser32",
"LowParse.SLow.Base.serializer32",
"LowParse.SLow.Base.bytes32",
"LowParse.Spec.Base.serializer_correct_implies_complete",
"Prims.unit",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.tuple2",
"FStar.UInt32.t",
"Prims.squash",
"Prims.l_and",
"Prims.op_LessThanOrEqual",
"FStar.UInt32.v",
"FStar.Bytes.length",
"Prims.eq2",
"FStar.Bytes.bytes",
"LowParse.Bytes32.b32slice",
"FStar.UInt32.__uint_to_t",
"FStar.Pervasives.Native.option",
"LowParse.SLow.Base.parser32_correct",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed | false | false | LowParse.SLow.Base.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 parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma (requires (Some? (p32 input)))
(ensures
(let Some (v, consumed) = p32 input in
U32.v consumed <= B32.length input /\ s32 v == B32.b32slice input 0ul consumed)) | [] | LowParse.SLow.Base.parser32_then_serializer32 | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
s: LowParse.Spec.Base.serializer p ->
p32: LowParse.SLow.Base.parser32 p ->
s32: LowParse.SLow.Base.serializer32 s ->
input: LowParse.SLow.Base.bytes32
-> FStar.Pervasives.Lemma (requires Some? (p32 input))
(ensures
(let _ = p32 input in
(let FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ v consumed) =
_
in
FStar.UInt32.v consumed <= FStar.Bytes.length input /\
s32 v == LowParse.Bytes32.b32slice input 0ul consumed)
<:
Type0)) | {
"end_col": 41,
"end_line": 199,
"start_col": 2,
"start_line": 199
} |
FStar.Pervasives.Lemma | val parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, _) = p1 in
let Some (v2, _) = p2 in
v1 == v2)))
(ensures
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, consumed1) = p1 in
let Some (v2, consumed2) = p2 in
v1 == v2 /\ consumed1 == consumed2 /\ U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2))) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": 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 parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2)) | val parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, _) = p1 in
let Some (v2, _) = p2 in
v1 == v2)))
(ensures
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, consumed1) = p1 in
let Some (v2, consumed2) = p2 in
v1 == v2 /\ consumed1 == consumed2 /\ U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2)))
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, _) = p1 in
let Some (v2, _) = p2 in
v1 == v2)))
(ensures
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, consumed1) = p1 in
let Some (v2, consumed2) = p2 in
v1 == v2 /\ consumed1 == consumed2 /\ U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2))) = | false | null | true | parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2)) | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"lemma"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.SLow.Base.parser32",
"LowParse.SLow.Base.bytes32",
"Prims._assert",
"LowParse.Spec.Base.injective_postcond",
"FStar.Bytes.reveal",
"Prims.unit",
"LowParse.Spec.Base.injective_precond",
"LowParse.Spec.Base.parser_kind_prop_equiv",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.tuple2",
"FStar.UInt32.t",
"Prims.eq2",
"Prims.logical",
"FStar.Pervasives.Native.option",
"LowParse.SLow.Base.parser32_correct",
"Prims.squash",
"Prims.op_LessThanOrEqual",
"FStar.UInt32.v",
"FStar.Bytes.length",
"FStar.Bytes.bytes",
"LowParse.Bytes32.b32slice",
"FStar.UInt32.__uint_to_t",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2 | false | false | LowParse.SLow.Base.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 parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, _) = p1 in
let Some (v2, _) = p2 in
v1 == v2)))
(ensures
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let Some (v1, consumed1) = p1 in
let Some (v2, consumed2) = p2 in
v1 == v2 /\ consumed1 == consumed2 /\ U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2))) | [] | LowParse.SLow.Base.parser32_injective | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p32: LowParse.SLow.Base.parser32 p ->
input1: LowParse.SLow.Base.bytes32 ->
input2: LowParse.SLow.Base.bytes32
-> FStar.Pervasives.Lemma
(requires
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let _ = p1 in
(let FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ v1 _) =
_
in
let _ = p2 in
(let FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ v2 _) =
_
in
v1 == v2)
<:
Prims.logical)
<:
Prims.logical)))
(ensures
(let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\ Some? p2 /\
(let _ = p1 in
(let
FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ v1 consumed1)
=
_
in
let _ = p2 in
(let
FStar.Pervasives.Native.Some
#_
(FStar.Pervasives.Native.Mktuple2 #_ #_ v2 consumed2) =
_
in
v1 == v2 /\ consumed1 == consumed2 /\
FStar.UInt32.v consumed1 <= FStar.Bytes.length input1 /\
FStar.UInt32.v consumed2 <= FStar.Bytes.length input2 /\
LowParse.Bytes32.b32slice input1 0ul consumed1 ==
LowParse.Bytes32.b32slice input2 0ul consumed2)
<:
Prims.logical)
<:
Prims.logical))) | {
"end_col": 71,
"end_line": 251,
"start_col": 2,
"start_line": 249
} |
Prims.Tot | val parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32:
parser32 p
{ k.parser_kind_subkind == Some ParserStrong /\
(match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296) })
(x: Seq.seq byte)
: Tot (y: _{y == parse p x}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p {
k.parser_kind_subkind == Some ParserStrong /\
begin match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296
end
})
(x: Seq.seq byte)
: Tot (y: _ { y == parse p x })
= match k.parser_kind_high with
| Some max ->
if Seq.length x < max
then
match p32 (bytes_of_seq x) with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
else begin
[@inline_let]
let max32 = U32.uint_to_t max in
let res = p32 (bytes_of_seq (Seq.slice x 0 max)) in
Classical.move_requires (parse_strong_prefix p x) (Seq.slice x 0 max);
Classical.move_requires (parse_strong_prefix p (Seq.slice x 0 max)) x;
parser_kind_prop_equiv k p;
match res with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
end | val parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32:
parser32 p
{ k.parser_kind_subkind == Some ParserStrong /\
(match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296) })
(x: Seq.seq byte)
: Tot (y: _{y == parse p x})
let parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32:
parser32 p
{ k.parser_kind_subkind == Some ParserStrong /\
(match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296) })
(x: Seq.seq byte)
: Tot (y: _{y == parse p x}) = | false | null | false | match k.parser_kind_high with
| Some max ->
if Seq.length x < max
then
match p32 (bytes_of_seq x) with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed)
else
[@@ inline_let ]let max32 = U32.uint_to_t max in
let res = p32 (bytes_of_seq (Seq.slice x 0 max)) in
Classical.move_requires (parse_strong_prefix p x) (Seq.slice x 0 max);
Classical.move_requires (parse_strong_prefix p (Seq.slice x 0 max)) x;
parser_kind_prop_equiv k p;
match res with
| None -> None
| Some (x, consumed) -> Some (x, U32.v consumed) | {
"checked_file": "LowParse.SLow.Base.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.Base.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.SLow.Base.parser32",
"Prims.l_and",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high",
"Prims.l_False",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.logical",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"FStar.Seq.Base.length",
"LowParse.SLow.Base.bytes_of_seq",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"FStar.UInt32.t",
"FStar.Pervasives.Native.Mktuple2",
"FStar.UInt32.v",
"LowParse.Spec.Base.parse",
"Prims.bool",
"Prims.unit",
"LowParse.Spec.Base.parser_kind_prop_equiv",
"FStar.Classical.move_requires",
"LowParse.Bytes.bytes",
"FStar.Seq.Base.slice",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.equal",
"LowParse.Spec.Base.parse_strong_prefix",
"LowParse.SLow.Base.parser32_correct",
"FStar.UInt32.uint_to_t"
] | [] | module LowParse.SLow.Base
include LowParse.Spec.Base
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
let bytes32 = B32.bytes
let parser32_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option (t * U32.t))
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (hres, consumed) ->
Some? gp /\ (
let (Some (hres' , consumed')) = gp in
hres == hres' /\
U32.v consumed == (consumed' <: nat)
)
[@unifier_hint_injective]
inline_for_extraction
let parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option (t * U32.t) { parser32_correct p input res } )
let parser32_consumes
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(Some? (p32 input) ==> (let (Some (_, consumed)) = p32 input in U32.v consumed <= B32.length input))
= ()
let parser32_consumes'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(match p32 input with
| Some (_, consumed) -> U32.v consumed <= B32.length input
| _ -> True)
= ()
inline_for_extraction
let make_parser32
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(p32: (input: bytes32) -> Pure (option (t * U32.t)) (requires True) (ensures (fun res -> parser32_correct p input res)))
: Tot (parser32 p)
= (fun (input: bytes32) -> (p32 input <: (res: option (t * U32.t) { parser32_correct p input res } )))
inline_for_extraction
let coerce_parser32
(t2: Type)
(#k: parser_kind)
(#t1: Type)
(#p: parser k t1)
(p32: parser32 p)
(u: unit { t2 == t1 } )
: Tot (parser32 (coerce_parser t2 p))
= p32
let validator_correct
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input: bytes32)
(res: option U32.t)
: GTot Type0
= let gp = parse p (B32.reveal input) in
match res with
| None -> gp == None
| Some (consumed) ->
Some? gp /\ (
let (Some (_ , consumed')) = gp in
U32.v consumed == (consumed' <: nat)
)
let validator
(#k: parser_kind)
(#t: Type)
(p: parser k t)
: Tot Type
= (input: bytes32) -> Tot (res: option U32.t { validator_correct p input res } )
let serializer32_correct
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res == s input
let serializer32_correct'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: GTot Type0
= B32.reveal res `bytes_equal` s input
[@unifier_hint_injective]
inline_for_extraction
let serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_correct_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(input: t)
(res: bytes32)
: Lemma
(requires (serializer32_correct s input res))
(ensures (
let len = FStar.Bytes.length res in
k.parser_kind_low <= len /\ (
match k.parser_kind_high with
| Some max -> len <= max
| _ -> True
)))
[SMTPat (serializer32_correct s input res); SMTPat (FStar.Bytes.length res)]
= serialize_length s input
inline_for_extraction
let serialize32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': serializer32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (serializer32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
inline_for_extraction
let partial_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (input: t { Seq.length (s input) < 4294967296 } ) -> Tot (res: bytes32 { serializer32_correct s input res } )
let serializer32_then_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: t)
: Lemma
(p32 (s32 input) == Some (input, B32.len (s32 input)))
= ()
let parser32_then_serializer32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
: Lemma
(requires (Some? (p32 input)))
(ensures (
let (Some (v, consumed)) = p32 input in
U32.v consumed <= B32.length input /\
s32 v == B32.b32slice input 0ul consumed
))
= serializer_correct_implies_complete p s
let parser32_then_serializer32'
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(#s: serializer p)
(p32: parser32 p)
(s32: serializer32 s)
(input: bytes32)
(v: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (v, consumed)))
(ensures (
B32.length (s32 v) == U32.v consumed /\
U32.v consumed <= B32.length input /\
B32.reveal (s32 v) == Seq.slice (B32.reveal input) 0 (U32.v consumed)
))
= parser32_then_serializer32 s p32 s32 input
let parser32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input1 input2: bytes32)
: Lemma
(requires (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, _)) = p1 in
let (Some (v2, _)) = p2 in
v1 == v2
)))
(ensures (
let p1 = p32 input1 in
let p2 = p32 input2 in
Some? p1 /\
Some? p2 /\ (
let (Some (v1, consumed1)) = p1 in
let (Some (v2, consumed2)) = p2 in
v1 == v2 /\
consumed1 == consumed2 /\
U32.v consumed1 <= B32.length input1 /\
U32.v consumed2 <= B32.length input2 /\
B32.b32slice input1 0ul consumed1 == B32.b32slice input2 0ul consumed2
)))
= parser_kind_prop_equiv k p;
assert (injective_precond p (B32.reveal input1) (B32.reveal input2));
assert (injective_postcond p (B32.reveal input1) (B32.reveal input2))
let serializer32_injective
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(s32: serializer32 s)
(input1 input2: t)
: Lemma
(requires (s32 input1 == s32 input2))
(ensures (input1 == input2))
= assert (parse p (serialize s input1) == parse p (serialize s input2))
let parse32_size
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
(data: t)
(consumed: U32.t)
: Lemma
(requires (p32 input == Some (data, consumed)))
(ensures (
k.parser_kind_low <= U32.v consumed /\ (
Some? k.parser_kind_high ==> (
let (Some hi) = k.parser_kind_high in
U32.v consumed <= hi
))))
= parser_kind_prop_equiv k p
let parse32_total
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p)
(input: bytes32)
: Lemma
(requires (
k.parser_kind_high == Some k.parser_kind_low /\
k.parser_kind_metadata == Some ParserKindMetadataTotal /\
k.parser_kind_low <= B32.length input
))
(ensures (
Some? (p32 input)
))
= parser_kind_prop_equiv k p
inline_for_extraction
let u32_max : (y: U32.t { forall (x: U32.t) . {:pattern (U32.v x)} U32.v x <= U32.v y } ) =
4294967295ul
inline_for_extraction
let add_overflow
(x y: U32.t)
: Pure U32.t
(requires True)
(ensures (fun z ->
if U32.v x + U32.v y > U32.v u32_max then
z == u32_max
else U32.v z == U32.v x + U32.v y
))
= if U32.lt (U32.sub u32_max y) x
then u32_max
else U32.add x y
let size32_postcond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
(y: U32.t)
: GTot Type0
= let sz = Seq.length (serialize s x) in
if sz > U32.v u32_max
then y == u32_max
else U32.v y == sz
[@unifier_hint_injective]
inline_for_extraction
let size32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
: Tot Type
= (x: t) ->
Tot (y: U32.t {
size32_postcond s x y
})
let size32_constant_precond
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
: GTot Type0
= k.parser_kind_high == Some k.parser_kind_low /\
U32.v len32 == k.parser_kind_low
inline_for_extraction
let size32_constant
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(len32: U32.t)
(u: unit { size32_constant_precond s len32 } )
: Tot (size32 s)
= fun x ->
[@inline_let]
let (z: U32.t { size32_postcond s x z } ) = len32 in
z
inline_for_extraction
let size32_ext
(#k1: parser_kind)
(#t1: Type)
(p1: parser k1 t1)
(s1: serializer p1)
(s1': size32 s1)
(#k2: parser_kind)
(#t2: Type)
(p2: parser k2 t2)
(u: squash (t1 == t2 /\ (forall (input: bytes) . parse p1 input == parse p2 input)))
: Tot (size32 (serialize_ext p1 s1 p2))
= fun input -> s1' input
(* Total parsers for sequences *)
[@"opaque_to_smt"]
irreducible
let rec bytes_of_seq'
(x: Seq.seq byte)
(accu: bytes32 { B32.length accu + Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` (B32.reveal accu `Seq.append` x) })
(decreases (Seq.length x))
= if Seq.length x = 0
then accu
else bytes_of_seq' (Seq.tail x) (B32.append accu (B32.create 1ul (Seq.head x)))
[@"opaque_to_smt"]
inline_for_extraction
let bytes_of_seq
(x: Seq.seq byte { Seq.length x < 4294967296 })
: Tot (y: bytes32 { B32.reveal y `Seq.equal` x })
= bytes_of_seq' x B32.empty_bytes
inline_for_extraction
let parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32: parser32 p {
k.parser_kind_subkind == Some ParserStrong /\
begin match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296
end
})
(x: Seq.seq byte) | false | false | LowParse.SLow.Base.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_tot_seq_of_parser32
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(p32:
parser32 p
{ k.parser_kind_subkind == Some ParserStrong /\
(match k.parser_kind_high with
| None -> False
| Some max -> max < 4294967296) })
(x: Seq.seq byte)
: Tot (y: _{y == parse p x}) | [] | LowParse.SLow.Base.parse_tot_seq_of_parser32 | {
"file_name": "src/lowparse/LowParse.SLow.Base.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p32:
LowParse.SLow.Base.parser32 p
{ Mkparser_kind'?.parser_kind_subkind k ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\
(match Mkparser_kind'?.parser_kind_high k with
| FStar.Pervasives.Native.None #_ -> Prims.l_False
| FStar.Pervasives.Native.Some #_ max -> max < 4294967296) } ->
x: FStar.Seq.Base.seq LowParse.Bytes.byte
-> y:
FStar.Pervasives.Native.option (t * LowParse.Spec.Base.consumed_length x)
{y == LowParse.Spec.Base.parse p x} | {
"end_col": 7,
"end_line": 433,
"start_col": 2,
"start_line": 416
} |
Prims.Tot | val prime:pos | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prime: pos = Scalar.prime | val prime:pos
let prime:pos = | false | null | false | Scalar.prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Spec.Poly1305.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false" | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val prime:pos | [] | Hacl.Spec.Poly1305.Lemmas.prime | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.pos | {
"end_col": 29,
"end_line": 13,
"start_col": 17,
"start_line": 13
} |
Prims.Tot | val pfelem_mul_cm:cm pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity | val pfelem_mul_cm:cm pfelem
let pfelem_mul_cm:cm pfelem = | false | null | false | CM one ( *% ) mul_identity mul_associativity mul_commutativity | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"FStar.Algebra.CommMonoid.CM",
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Hacl.Spec.Poly1305.Lemmas.one",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Hacl.Spec.Poly1305.Lemmas.mul_identity",
"Hacl.Spec.Poly1305.Lemmas.mul_associativity",
"Hacl.Spec.Poly1305.Lemmas.mul_commutativity"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr] | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pfelem_mul_cm:cm pfelem | [] | Hacl.Spec.Poly1305.Lemmas.pfelem_mul_cm | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Algebra.CommMonoid.cm Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 64,
"end_line": 83,
"start_col": 2,
"start_line": 83
} |
Prims.Tot | val pfelem_add_cm:cm pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity | val pfelem_add_cm:cm pfelem
let pfelem_add_cm:cm pfelem = | false | null | false | CM zero ( +% ) add_identity add_associativity add_commutativity | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"FStar.Algebra.CommMonoid.CM",
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Hacl.Spec.Poly1305.Lemmas.zero",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Hacl.Spec.Poly1305.Lemmas.add_identity",
"Hacl.Spec.Poly1305.Lemmas.add_associativity",
"Hacl.Spec.Poly1305.Lemmas.add_commutativity"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr] | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pfelem_add_cm:cm pfelem | [] | Hacl.Spec.Poly1305.Lemmas.pfelem_add_cm | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Algebra.CommMonoid.cm Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 65,
"end_line": 79,
"start_col": 2,
"start_line": 79
} |
FStar.Tactics.Effect.Tac | val poly_semiring: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_semiring () : Tac unit = canon_semiring pfelem_cr; trefl() | val poly_semiring: Prims.unit -> Tac unit
let poly_semiring () : Tac unit = | true | null | false | canon_semiring pfelem_cr;
trefl () | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.trefl",
"FStar.Tactics.CanonCommSemiring.canon_semiring",
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Hacl.Spec.Poly1305.Lemmas.pfelem_cr"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr]
let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l
open FStar.Tactics | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_semiring: Prims.unit -> Tac unit | [] | Hacl.Spec.Poly1305.Lemmas.poly_semiring | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 67,
"end_line": 124,
"start_col": 34,
"start_line": 124
} |
Prims.Tot | val one:pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let one : pfelem = normalize_term_spec prime; 1 | val one:pfelem
let one:pfelem = | false | null | false | normalize_term_spec prime;
1 | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos",
"Hacl.Spec.Poly1305.Lemmas.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0 | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val one:pfelem | [] | Hacl.Spec.Poly1305.Lemmas.one | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 47,
"end_line": 21,
"start_col": 19,
"start_line": 21
} |
Prims.Tot | val op_Tilde_Percent (a: pfelem) : pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( ~% ) (a:pfelem) : pfelem = (-a) % prime | val op_Tilde_Percent (a: pfelem) : pfelem
let op_Tilde_Percent (a: pfelem) : pfelem = | false | null | false | (- a) % prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Prims.op_Modulus",
"Prims.op_Minus",
"Hacl.Spec.Poly1305.Lemmas.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Tilde_Percent (a: pfelem) : pfelem | [] | Hacl.Spec.Poly1305.Lemmas.op_Tilde_Percent | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem -> Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 45,
"end_line": 30,
"start_col": 33,
"start_line": 30
} |
Prims.Tot | val op_Plus_Percent (a b: pfelem) : pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime | val op_Plus_Percent (a b: pfelem) : pfelem
let op_Plus_Percent (a b: pfelem) : pfelem = | false | null | false | (a + b) % prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Prims.op_Modulus",
"Prims.op_Addition",
"Hacl.Spec.Poly1305.Lemmas.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1 | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Percent (a b: pfelem) : pfelem | [] | Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem -> b: Hacl.Spec.Poly1305.Lemmas.pfelem
-> Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 50,
"end_line": 24,
"start_col": 35,
"start_line": 24
} |
Prims.Tot | val zero:pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let zero : pfelem = 0 | val zero:pfelem
let zero:pfelem = | false | null | false | 0 | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime} | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val zero:pfelem | [] | Hacl.Spec.Poly1305.Lemmas.zero | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 21,
"end_line": 18,
"start_col": 20,
"start_line": 18
} |
Prims.Tot | val pfelem_cr:cr pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l | val pfelem_cr:cr pfelem
let pfelem_cr:cr pfelem = | false | null | false | CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"FStar.Tactics.CanonCommSemiring.CR",
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Hacl.Spec.Poly1305.Lemmas.pfelem_add_cm",
"Hacl.Spec.Poly1305.Lemmas.pfelem_mul_cm",
"Hacl.Spec.Poly1305.Lemmas.op_Tilde_Percent",
"Hacl.Spec.Poly1305.Lemmas.add_opp",
"Hacl.Spec.Poly1305.Lemmas.mul_add_distr",
"Hacl.Spec.Poly1305.Lemmas.mul_zero_l"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr] | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pfelem_cr:cr pfelem | [] | Hacl.Spec.Poly1305.Lemmas.pfelem_cr | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Tactics.CanonCommSemiring.cr Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 72,
"end_line": 120,
"start_col": 2,
"start_line": 120
} |
Prims.Tot | val op_Star_Percent (a b: pfelem) : pfelem | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime | val op_Star_Percent (a b: pfelem) : pfelem
let op_Star_Percent (a b: pfelem) : pfelem = | false | null | false | (a * b) % prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Hacl.Spec.Poly1305.Lemmas.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Percent (a b: pfelem) : pfelem | [] | Hacl.Spec.Poly1305.Lemmas.op_Star_Percent | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem -> b: Hacl.Spec.Poly1305.Lemmas.pfelem
-> Hacl.Spec.Poly1305.Lemmas.pfelem | {
"end_col": 50,
"end_line": 27,
"start_col": 35,
"start_line": 27
} |
Prims.Tot | val pfelem:eqtype | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pfelem : eqtype = a:nat{a < prime} | val pfelem:eqtype
let pfelem:eqtype = | false | null | false | a: nat{a < prime} | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Spec.Poly1305.Lemmas.prime"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pfelem:eqtype | [] | Hacl.Spec.Poly1305.Lemmas.pfelem | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 38,
"end_line": 15,
"start_col": 22,
"start_line": 15
} |
FStar.Pervasives.Lemma | val add_opp (a:pfelem) : Lemma (a +% ~%a == zero) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime | val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a = | false | null | true | FStar.Math.Lemmas.lemma_mod_add_distr a (- a) prime;
FStar.Math.Lemmas.small_mod 0 prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Math.Lemmas.small_mod",
"Hacl.Spec.Poly1305.Lemmas.prime",
"Prims.unit",
"FStar.Math.Lemmas.lemma_mod_add_distr",
"Prims.op_Minus"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val add_opp (a:pfelem) : Lemma (a +% ~%a == zero) | [] | Hacl.Spec.Poly1305.Lemmas.add_opp | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma (ensures a +% ~%a == Hacl.Spec.Poly1305.Lemmas.zero) | {
"end_col": 37,
"end_line": 116,
"start_col": 2,
"start_line": 115
} |
FStar.Pervasives.Lemma | val mul_identity: a:pfelem -> Lemma (one *% a == a) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_identity a = normalize_term_spec prime | val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = | false | null | true | normalize_term_spec prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos",
"Hacl.Spec.Poly1305.Lemmas.prime",
"Prims.unit"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_identity: a:pfelem -> Lemma (one *% a == a) | [] | Hacl.Spec.Poly1305.Lemmas.mul_identity | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Lemmas.one *% a == a) | {
"end_col": 46,
"end_line": 36,
"start_col": 21,
"start_line": 36
} |
FStar.Pervasives.Lemma | val add_identity: a:pfelem -> Lemma (zero +% a == a) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_identity a = normalize_term_spec prime | val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = | false | null | true | normalize_term_spec prime | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos",
"Hacl.Spec.Poly1305.Lemmas.prime",
"Prims.unit"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val add_identity: a:pfelem -> Lemma (zero +% a == a) | [] | Hacl.Spec.Poly1305.Lemmas.add_identity | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Lemmas.zero +% a == a) | {
"end_col": 46,
"end_line": 33,
"start_col": 21,
"start_line": 33
} |
Prims.Tot | val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_zero_l a = assert_norm (forall x. zero *% x == zero) | val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = | false | null | false | assert_norm (forall x. zero *% x == zero) | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Pervasives.assert_norm",
"Prims.l_Forall",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Hacl.Spec.Poly1305.Lemmas.zero",
"Prims.unit"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
} | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm | [] | Hacl.Spec.Poly1305.Lemmas.mul_zero_l | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Tactics.CanonCommSemiring.mult_zero_l_lemma Hacl.Spec.Poly1305.Lemmas.pfelem
Hacl.Spec.Poly1305.Lemmas.pfelem_add_cm
Hacl.Spec.Poly1305.Lemmas.pfelem_mul_cm | {
"end_col": 60,
"end_line": 111,
"start_col": 19,
"start_line": 111
} |
FStar.Pervasives.Lemma | val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c)) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
} | val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c = | false | null | true | normalize_term_spec prime;
calc ( == ) {
a +% b +% c;
( == ) { () }
((a + b) % prime + c) % prime;
( == ) { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
( == ) { () }
(a + (b + c)) % prime;
( == ) { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
} | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Calc.calc_finish",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Modulus",
"Prims.op_Addition",
"Hacl.Spec.Poly1305.Lemmas.prime",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"FStar.Math.Lemmas.lemma_mod_plus_distr_l",
"FStar.Math.Lemmas.lemma_mod_plus_distr_r",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c)) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c)) | [] | Hacl.Spec.Poly1305.Lemmas.add_associativity | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Hacl.Spec.Poly1305.Lemmas.pfelem ->
b: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma (ensures a +% b +% c == a +% (b +% c)) | {
"end_col": 3,
"end_line": 52,
"start_col": 2,
"start_line": 41
} |
FStar.Pervasives.Lemma | val poly_update_multi_lemma_load2_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem ->
Lemma
( (((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r ) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_update_multi_lemma_load2_simplify acc0 r c0 c1 =
assert (
(((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r )
by (poly_semiring ()) | val poly_update_multi_lemma_load2_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem ->
Lemma
( (((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r )
let poly_update_multi_lemma_load2_simplify acc0 r c0 c1 = | false | null | true | FStar.Tactics.Effect.assert_by_tactic ((((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r)
(fun _ ->
();
(poly_semiring ())) | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Prims.unit",
"Hacl.Spec.Poly1305.Lemmas.poly_semiring"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr]
let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l
open FStar.Tactics
let poly_semiring () : Tac unit = canon_semiring pfelem_cr; trefl()
/// Lemmas
val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
let poly_update_repeat_blocks_multi_lemma2_simplify acc0 acc1 c0 c1 r =
assert (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
by (poly_semiring ())
val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
let poly_update_repeat_blocks_multi_lemma4_simplify a0 a1 a2 a3 c0 c1 c2 c3 r r2 r4 =
let r2 = r *% r in
let r4 = r2 *% r2 in
assert (
((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
by (poly_semiring ())
val poly_update_multi_lemma_load2_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem ->
Lemma
( (((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r ) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_update_multi_lemma_load2_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem ->
Lemma
( (((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r ) | [] | Hacl.Spec.Poly1305.Lemmas.poly_update_multi_lemma_load2_simplify | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
acc0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
r: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c1: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma
(ensures ((acc0 +% c0) *% r +% c1) *% r == (acc0 +% c0) *% (r *% r) +% c1 *% r) | {
"end_col": 23,
"end_line": 178,
"start_col": 2,
"start_line": 175
} |
FStar.Pervasives.Lemma | val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r ) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_update_repeat_blocks_multi_lemma2_simplify acc0 acc1 c0 c1 r =
assert (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
by (poly_semiring ()) | val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
let poly_update_repeat_blocks_multi_lemma2_simplify acc0 acc1 c0 c1 r = | false | null | true | FStar.Tactics.Effect.assert_by_tactic ((acc0 *% (r *% r) +% c0) *% (r *% r) +%
(acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r)
(fun _ ->
();
(poly_semiring ())) | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Prims.unit",
"Hacl.Spec.Poly1305.Lemmas.poly_semiring"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr]
let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l
open FStar.Tactics
let poly_semiring () : Tac unit = canon_semiring pfelem_cr; trefl()
/// Lemmas
val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r ) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r ) | [] | Hacl.Spec.Poly1305.Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
acc0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
acc1: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c1: Hacl.Spec.Poly1305.Lemmas.pfelem ->
r: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma
(ensures
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((acc0 *% (r *% r) +% acc1 *% r +% c0) *% r +% c1) *% r) | {
"end_col": 23,
"end_line": 138,
"start_col": 2,
"start_line": 135
} |
FStar.Pervasives.Lemma | val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c)) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
} | val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c = | false | null | true | calc ( == ) {
a *% b *% c;
( == ) { () }
(((a * b) % prime) * c) % prime;
( == ) { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
( == ) { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
( == ) { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
( == ) { () }
a *% (b *% c);
} | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Calc.calc_finish",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Hacl.Spec.Poly1305.Lemmas.prime",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"FStar.Math.Lemmas.lemma_mod_mul_distr_l",
"FStar.Math.Lemmas.paren_mul_right",
"FStar.Math.Lemmas.lemma_mod_mul_distr_r"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c)) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c)) | [] | Hacl.Spec.Poly1305.Lemmas.mul_associativity | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Hacl.Spec.Poly1305.Lemmas.pfelem ->
b: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma (ensures a *% b *% c == a *% (b *% c)) | {
"end_col": 3,
"end_line": 72,
"start_col": 2,
"start_line": 60
} |
FStar.Pervasives.Lemma | val poly_update_multi_lemma_load4_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem ->
Lemma
( (((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +%
(c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +% c3 *% r ) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 =
assert (
(((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +%
(c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +% c3 *% r )
by (poly_semiring ()) | val poly_update_multi_lemma_load4_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem ->
Lemma
( (((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +%
(c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +% c3 *% r )
let poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 = | false | null | true | FStar.Tactics.Effect.assert_by_tactic ((((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *%
r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +% (c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +%
c3 *% r)
(fun _ ->
();
(poly_semiring ())) | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Prims.unit",
"Hacl.Spec.Poly1305.Lemmas.poly_semiring"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr]
let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l
open FStar.Tactics
let poly_semiring () : Tac unit = canon_semiring pfelem_cr; trefl()
/// Lemmas
val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
let poly_update_repeat_blocks_multi_lemma2_simplify acc0 acc1 c0 c1 r =
assert (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
by (poly_semiring ())
val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
let poly_update_repeat_blocks_multi_lemma4_simplify a0 a1 a2 a3 c0 c1 c2 c3 r r2 r4 =
let r2 = r *% r in
let r4 = r2 *% r2 in
assert (
((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
by (poly_semiring ())
val poly_update_multi_lemma_load2_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem ->
Lemma
( (((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r )
let poly_update_multi_lemma_load2_simplify acc0 r c0 c1 =
assert (
(((acc0 +% c0) *% r) +% c1) *% r ==
((acc0 +% c0) *% (r *% r)) +% c1 *% r )
by (poly_semiring ())
val poly_update_multi_lemma_load4_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem ->
Lemma
( (((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +%
(c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +% c3 *% r ) | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_update_multi_lemma_load4_simplify:
acc0:pfelem -> r:pfelem -> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem ->
Lemma
( (((((((acc0 +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r ==
((((acc0 +% c0) *% ((r *% r) *% (r *% r))) +%
(c1 *% ((r *% r) *% r))) +% (c2 *% (r *% r))) +% c3 *% r ) | [] | Hacl.Spec.Poly1305.Lemmas.poly_update_multi_lemma_load4_simplify | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
acc0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
r: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c1: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c2: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c3: Hacl.Spec.Poly1305.Lemmas.pfelem
-> FStar.Pervasives.Lemma
(ensures
((((acc0 +% c0) *% r +% c1) *% r +% c2) *% r +% c3) *% r ==
(acc0 +% c0) *% (r *% r *% (r *% r)) +% c1 *% (r *% r *% r) +% c2 *% (r *% r) +% c3 *% r) | {
"end_col": 23,
"end_line": 191,
"start_col": 2,
"start_line": 187
} |
Prims.Tot | val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm | [
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
} | val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c = | false | null | false | normalize_term_spec prime;
calc ( == ) {
a *% (b +% c);
( == ) { () }
(a * (b +% c)) % prime;
( == ) { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
( == ) { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
( == ) { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
( == ) { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
( == ) { () }
(a *% c + a * b) % prime;
( == ) { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
( == ) { () }
(a *% b + a *% c) % prime;
( == ) { () }
a *% b +% a *% c;
} | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"total"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"FStar.Calc.calc_finish",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Modulus",
"Prims.op_Addition",
"Hacl.Spec.Poly1305.Lemmas.prime",
"FStar.Mul.op_Star",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"FStar.Math.Lemmas.lemma_mod_add_distr",
"FStar.Math.Lemmas.lemma_mod_mul_distr_r",
"FStar.Math.Lemmas.distributivity_add_right",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm | false | true | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm | [] | Hacl.Spec.Poly1305.Lemmas.mul_add_distr | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Tactics.CanonCommSemiring.distribute_left_lemma Hacl.Spec.Poly1305.Lemmas.pfelem
Hacl.Spec.Poly1305.Lemmas.pfelem_add_cm
Hacl.Spec.Poly1305.Lemmas.pfelem_mul_cm | {
"end_col": 3,
"end_line": 108,
"start_col": 2,
"start_line": 87
} |
FStar.Pervasives.Lemma | val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) ) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.CanonCommSemiring",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Scalar"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Poly1305",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_update_repeat_blocks_multi_lemma4_simplify a0 a1 a2 a3 c0 c1 c2 c3 r r2 r4 =
let r2 = r *% r in
let r4 = r2 *% r2 in
assert (
((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
by (poly_semiring ()) | val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) )
let poly_update_repeat_blocks_multi_lemma4_simplify a0 a1 a2 a3 c0 c1 c2 c3 r r2 r4 = | false | null | true | let r2 = r *% r in
let r4 = r2 *% r2 in
FStar.Tactics.Effect.assert_by_tactic (((a0 *% r4 +% c0) *% r4) +% ((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r) ==
(((((((((((a0 *% r4 +% (a1 *% (r2 *% r))) +% a2 *% r2) +% a3 *% r) +% c0) *% r) +% c1) *% r) +%
c2) *%
r) +%
c3) *%
r))
(fun _ ->
();
(poly_semiring ())) | {
"checked_file": "Hacl.Spec.Poly1305.Lemmas.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.CanonCommSemiring.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked",
"FStar.Algebra.CommMonoid.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Poly1305.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Poly1305.Lemmas.pfelem",
"Prims.eq2",
"Hacl.Spec.Poly1305.Lemmas.op_Star_Percent",
"FStar.Tactics.Effect.assert_by_tactic",
"Hacl.Spec.Poly1305.Lemmas.op_Plus_Percent",
"Prims.unit",
"Hacl.Spec.Poly1305.Lemmas.poly_semiring"
] | [] | module Hacl.Spec.Poly1305.Lemmas
open FStar.Mul
module Scalar = Spec.Poly1305
open FStar.Algebra.CommMonoid
open FStar.Tactics.CanonCommSemiring
/// Semiring for Poly1305
#set-options "--z3rlimit 5 --max_fuel 0 --max_ifuel 0 --z3cliopt smt.arith.nl=false"
let prime: pos = Scalar.prime
let pfelem : eqtype = a:nat{a < prime}
[@canon_attr]
let zero : pfelem = 0
[@canon_attr]
let one : pfelem = normalize_term_spec prime; 1
//[@(strict_on_arguments [0;1])]
let ( +% ) (a b:pfelem) : pfelem = (a + b) % prime
//[@(strict_on_arguments [0;1])]
let ( *% ) (a b:pfelem) : pfelem = (a * b) % prime
//[@(strict_on_arguments [0])]
let ( ~% ) (a:pfelem) : pfelem = (-a) % prime
val add_identity: a:pfelem -> Lemma (zero +% a == a)
let add_identity a = normalize_term_spec prime
val mul_identity: a:pfelem -> Lemma (one *% a == a)
let mul_identity a = normalize_term_spec prime
val add_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a +% b +% c == a +% (b +% c))
let add_associativity a b c =
normalize_term_spec prime;
calc (==) {
a +% b +% c;
== { }
((a + b) % prime + c) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c prime }
((a + b) + c) % prime;
== { }
(a + (b + c)) % prime;
== { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) prime }
a +% (b +% c);
}
val add_commutativity: a:pfelem -> b:pfelem -> Lemma (a +% b == b +% a)
let add_commutativity a b = ()
val mul_associativity: a:pfelem -> b:pfelem -> c:pfelem
-> Lemma (a *% b *% c == a *% (b *% c))
let mul_associativity a b c =
calc (==) {
a *% b *% c;
== { }
(((a * b) % prime) * c) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c prime }
((a * b) * c) % prime;
== { Math.Lemmas.paren_mul_right a b c }
(a * (b * c)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) prime }
(a * ((b * c) % prime)) % prime;
== { }
a *% (b *% c);
}
val mul_commutativity: a:pfelem -> b:pfelem -> Lemma (a *% b == b *% a)
let mul_commutativity a b = ()
[@canon_attr]
let pfelem_add_cm : cm pfelem =
CM zero ( +% ) add_identity add_associativity add_commutativity
[@canon_attr]
let pfelem_mul_cm : cm pfelem =
CM one ( *% ) mul_identity mul_associativity mul_commutativity
val mul_add_distr: distribute_left_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_add_distr a b c =
normalize_term_spec prime;
calc (==) {
a *% (b +% c);
== { }
(a * (b +% c)) % prime;
== { Math.Lemmas.lemma_mod_add_distr a (b + c) prime }
(a * ((b + c) % prime)) % prime;
== { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) prime }
(a * (b + c)) % prime;
== { Math.Lemmas.distributivity_add_right a b c }
(a * b + a * c) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a * b) (a * c) prime }
(a * b + a *% c) % prime;
== { }
(a *% c + a * b) % prime;
== { Math.Lemmas.lemma_mod_add_distr (a *% c) (a * b) prime }
(a *% c + a *% b) % prime;
== { }
(a *% b + a *% c) % prime;
== { }
a *% b +% a *% c;
}
val mul_zero_l: mult_zero_l_lemma pfelem pfelem_add_cm pfelem_mul_cm
let mul_zero_l a = assert_norm (forall x. zero *% x == zero)
val add_opp (a:pfelem) : Lemma (a +% ~%a == zero)
let add_opp a =
FStar.Math.Lemmas.lemma_mod_add_distr a (-a) prime;
FStar.Math.Lemmas.small_mod 0 prime
[@canon_attr]
let pfelem_cr : cr pfelem =
CR pfelem_add_cm pfelem_mul_cm ( ~% ) add_opp mul_add_distr mul_zero_l
open FStar.Tactics
let poly_semiring () : Tac unit = canon_semiring pfelem_cr; trefl()
/// Lemmas
val poly_update_repeat_blocks_multi_lemma2_simplify:
acc0:pfelem -> acc1:pfelem -> c0:pfelem -> c1:pfelem -> r:pfelem ->
Lemma (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
let poly_update_repeat_blocks_multi_lemma2_simplify acc0 acc1 c0 c1 r =
assert (
(acc0 *% (r *% r) +% c0) *% (r *% r) +% (acc1 *% (r *% r) +% c1) *% r ==
((((acc0 *% (r *% r) +% acc1 *% r) +% c0) *% r) +% c1) *% r )
by (poly_semiring ())
val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +% | false | false | Hacl.Spec.Poly1305.Lemmas.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": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_update_repeat_blocks_multi_lemma4_simplify:
a0:pfelem -> a1:pfelem -> a2:pfelem -> a3:pfelem
-> c0:pfelem -> c1:pfelem -> c2:pfelem -> c3:pfelem
-> r:pfelem -> r2:pfelem{r2 == r *% r} -> r4:pfelem {r4 == r2 *% r2} ->
Lemma
(((a0 *% r4 +% c0) *% r4) +%
((a1 *% r4 +% c1) *% (r2 *% r)) +%
((a2 *% r4 +% c2) *% r2) +%
((a3 *% r4 +% c3) *% r)
==
(((((((((((a0 *% r4 +%
(a1 *% (r2 *% r))) +%
a2 *% r2) +%
a3 *% r) +% c0) *% r) +% c1) *% r) +% c2) *% r) +% c3) *% r) ) | [] | Hacl.Spec.Poly1305.Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify | {
"file_name": "code/poly1305/Hacl.Spec.Poly1305.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
a1: Hacl.Spec.Poly1305.Lemmas.pfelem ->
a2: Hacl.Spec.Poly1305.Lemmas.pfelem ->
a3: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c0: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c1: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c2: Hacl.Spec.Poly1305.Lemmas.pfelem ->
c3: Hacl.Spec.Poly1305.Lemmas.pfelem ->
r: Hacl.Spec.Poly1305.Lemmas.pfelem ->
r2: Hacl.Spec.Poly1305.Lemmas.pfelem{r2 == r *% r} ->
r4: Hacl.Spec.Poly1305.Lemmas.pfelem{r4 == r2 *% r2}
-> FStar.Pervasives.Lemma
(ensures
(a0 *% r4 +% c0) *% r4 +% (a1 *% r4 +% c1) *% (r2 *% r) +% (a2 *% r4 +% c2) *% r2 +%
(a3 *% r4 +% c3) *% r ==
((((a0 *% r4 +% a1 *% (r2 *% r) +% a2 *% r2 +% a3 *% r +% c0) *% r +% c1) *% r +% c2) *% r +%
c3) *%
r) | {
"end_col": 23,
"end_line": 167,
"start_col": 85,
"start_line": 154
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let n = 32 | let n = | false | null | false | 32 | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) | false | true | FStar.Int32.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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val n : Prims.int | [] | FStar.Int32.n | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.int | {
"end_col": 17,
"end_line": 20,
"start_col": 15,
"start_line": 20
} |
|
Prims.Tot | val gt (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | val gt (a b: t) : Tot bool
let gt (a b: t) : Tot bool = | false | null | false | gt #n (v a) (v b) | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"FStar.Int.gt",
"FStar.Int32.n",
"FStar.Int32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *) | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gt (a b: t) : Tot bool | [] | FStar.Int32.gt | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 49,
"end_line": 115,
"start_col": 32,
"start_line": 115
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Percent_Hat = rem | let op_Percent_Hat = | false | null | false | rem | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.rem"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Percent_Hat : a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Percent_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t | {
"end_col": 31,
"end_line": 125,
"start_col": 28,
"start_line": 125
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Less_Less_Hat = shift_left | let op_Less_Less_Hat = | false | null | false | shift_left | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.shift_left"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Less_Hat : a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Less_Less_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 40,
"end_line": 129,
"start_col": 30,
"start_line": 129
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Greater_Greater_Hat = shift_right | let op_Greater_Greater_Hat = | false | null | false | shift_right | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.shift_right"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Greater_Hat : a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Greater_Greater_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 47,
"end_line": 130,
"start_col": 36,
"start_line": 130
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Star_Hat = mul | let op_Star_Hat = | false | null | false | mul | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.mul"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Star_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 28,
"end_line": 123,
"start_col": 25,
"start_line": 123
} |
|
Prims.Tot | val lt (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | val lt (a b: t) : Tot bool
let lt (a b: t) : Tot bool = | false | null | false | lt #n (v a) (v b) | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"FStar.Int.lt",
"FStar.Int32.n",
"FStar.Int32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lt (a b: t) : Tot bool | [] | FStar.Int32.lt | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 49,
"end_line": 117,
"start_col": 32,
"start_line": 117
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Subtraction_Hat = sub | let op_Subtraction_Hat = | false | null | false | sub | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.sub"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *) | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Subtraction_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Subtraction_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 35,
"end_line": 122,
"start_col": 32,
"start_line": 122
} |
|
Prims.Tot | val gte (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | val gte (a b: t) : Tot bool
let gte (a b: t) : Tot bool = | false | null | false | gte #n (v a) (v b) | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"FStar.Int.gte",
"FStar.Int32.n",
"FStar.Int32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gte (a b: t) : Tot bool | [] | FStar.Int32.gte | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 51,
"end_line": 116,
"start_col": 33,
"start_line": 116
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Amp_Hat = logand | let op_Amp_Hat = | false | null | false | logand | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.logand"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Amp_Hat : x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Amp_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 30,
"end_line": 127,
"start_col": 24,
"start_line": 127
} |
|
Prims.Tot | val eq (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | val eq (a b: t) : Tot bool
let eq (a b: t) : Tot bool = | false | null | false | eq #n (v a) (v b) | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"FStar.Int.eq",
"FStar.Int32.n",
"FStar.Int32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val eq (a b: t) : Tot bool | [] | FStar.Int32.eq | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 49,
"end_line": 114,
"start_col": 32,
"start_line": 114
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Bar_Hat = logor | let op_Bar_Hat = | false | null | false | logor | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.logor"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Bar_Hat : x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Bar_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 29,
"end_line": 128,
"start_col": 24,
"start_line": 128
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Slash_Hat = div | let op_Slash_Hat = | false | null | false | div | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.div"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Slash_Hat : a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Slash_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t | {
"end_col": 29,
"end_line": 124,
"start_col": 26,
"start_line": 124
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Greater_Hat = gt | let op_Greater_Hat = | false | null | false | gt | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.gt"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | [] | FStar.Int32.op_Greater_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 30,
"end_line": 133,
"start_col": 28,
"start_line": 133
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Hat_Hat = logxor | let op_Hat_Hat = | false | null | false | logxor | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.logxor"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Hat_Hat : x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Hat_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Int32.t -> y: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 30,
"end_line": 126,
"start_col": 24,
"start_line": 126
} |
|
Prims.Tot | val lte (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) | val lte (a b: t) : Tot bool
let lte (a b: t) : Tot bool = | false | null | false | lte #n (v a) (v b) | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"FStar.Int.lte",
"FStar.Int32.n",
"FStar.Int32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lte (a b: t) : Tot bool | [] | FStar.Int32.lte | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 51,
"end_line": 118,
"start_col": 33,
"start_line": 118
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Greater_Equals_Hat = gte | let op_Greater_Equals_Hat = | false | null | false | gte | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.gte"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
unfold let op_Equals_Hat = eq | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Equals_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | [] | FStar.Int32.op_Greater_Equals_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 38,
"end_line": 134,
"start_col": 35,
"start_line": 134
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Equals_Hat = eq | let op_Equals_Hat = | false | null | false | eq | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.eq"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Equals_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | [] | FStar.Int32.op_Equals_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 29,
"end_line": 132,
"start_col": 27,
"start_line": 132
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Greater_Greater_Greater_Hat = shift_arithmetic_right | let op_Greater_Greater_Greater_Hat = | false | null | false | shift_arithmetic_right | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.shift_arithmetic_right"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Greater_Greater_Hat : a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Greater_Greater_Greater_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 66,
"end_line": 131,
"start_col": 44,
"start_line": 131
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Less_Hat = lt | let op_Less_Hat = | false | null | false | lt | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.lt"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
unfold let op_Equals_Hat = eq
unfold let op_Greater_Hat = gt | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | [] | FStar.Int32.op_Less_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 27,
"end_line": 135,
"start_col": 25,
"start_line": 135
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Less_Equals_Hat = lte | let op_Less_Equals_Hat = | false | null | false | lte | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.lte"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
unfold let op_Equals_Hat = eq
unfold let op_Greater_Hat = gt
unfold let op_Greater_Equals_Hat = gte | false | true | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Equals_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | [] | FStar.Int32.op_Less_Equals_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool | {
"end_col": 35,
"end_line": 136,
"start_col": 32,
"start_line": 136
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let op_Plus_Hat = add | let op_Plus_Hat = | false | null | false | add | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [] | [
"FStar.Int32.add"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Hat : a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | [] | FStar.Int32.op_Plus_Hat | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t | {
"end_col": 28,
"end_line": 121,
"start_col": 25,
"start_line": 121
} |
|
Prims.Tot | val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)}) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ct_abs (a:t{min_int n < v a}) : Tot (b:t{v b = abs (v a)}) =
let mask = a >>>^ UInt32.uint_to_t (n - 1) in
if 0 <= v a then
begin
sign_bit_positive (v a);
nth_lemma (v mask) (FStar.Int.zero _);
logxor_lemma_1 (v a)
end
else
begin
sign_bit_negative (v a);
nth_lemma (v mask) (ones _);
logxor_lemma_2 (v a);
lognot_negative (v a);
UInt.lemma_lognot_value #n (to_uint (v a))
end;
(a ^^ mask) -^ mask | val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)})
let ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)}) = | false | null | false | let mask = a >>>^ UInt32.uint_to_t (n - 1) in
if 0 <= v a
then
(sign_bit_positive (v a);
nth_lemma (v mask) (FStar.Int.zero _);
logxor_lemma_1 (v a))
else
(sign_bit_negative (v a);
nth_lemma (v mask) (ones _);
logxor_lemma_2 (v a);
lognot_negative (v a);
UInt.lemma_lognot_value #n (to_uint (v a)));
(a ^^ mask) -^ mask | {
"checked_file": "FStar.Int32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Int32.fsti"
} | [
"total"
] | [
"FStar.Int32.t",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Int.min_int",
"FStar.Int32.n",
"FStar.Int32.v",
"FStar.Int32.op_Subtraction_Hat",
"FStar.Int32.op_Hat_Hat",
"Prims.unit",
"Prims.op_LessThanOrEqual",
"FStar.Int.logxor_lemma_1",
"FStar.Int.nth_lemma",
"FStar.Int.zero",
"FStar.Int.sign_bit_positive",
"Prims.bool",
"FStar.UInt.lemma_lognot_value",
"FStar.Int.to_uint",
"FStar.Int.lognot_negative",
"FStar.Int.logxor_lemma_2",
"FStar.Int.ones",
"FStar.Int.sign_bit_negative",
"FStar.Int32.op_Greater_Greater_Greater_Hat",
"FStar.UInt32.uint_to_t",
"Prims.op_Subtraction",
"Prims.op_Equality",
"Prims.int",
"Prims.abs"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
new val t : eqtype
val v (x:t) : Tot (int_t n)
val int_to_t: x:int_t n -> Pure t
(requires True)
(ensures (fun y -> v y = x))
val uv_inv (x : t) : Lemma
(ensures (int_to_t (v x) == x))
[SMTPat (v x)]
val vu_inv (x : int_t n) : Lemma
(ensures (v (int_to_t x) == x))
[SMTPat (int_to_t x)]
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(* Subtraction primitives *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(* Multiplication primitives *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(* Division primitives *)
val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
(* Modulo primitives *)
(* If a/b is not representable the result of a%b is undefind *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
(* Bitwise operators *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(* Shift operators *)
(** If a is negative the result is implementation-defined *)
val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))
(** If a is negative or a * pow2 s is not representable the result is undefined *)
val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
(* Comparison operators *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(* Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Subtraction_Hat = sub
unfold let op_Star_Hat = mul
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
unfold let op_Equals_Hat = eq
unfold let op_Greater_Hat = gt
unfold let op_Greater_Equals_Hat = gte
unfold let op_Less_Hat = lt
unfold let op_Less_Equals_Hat = lte | false | false | FStar.Int32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)}) | [] | FStar.Int32.ct_abs | {
"file_name": "ulib/FStar.Int32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int32.t{FStar.Int.min_int FStar.Int32.n < FStar.Int32.v a}
-> b: FStar.Int32.t{FStar.Int32.v b = Prims.abs (FStar.Int32.v a)} | {
"end_col": 21,
"end_line": 155,
"start_col": 64,
"start_line": 139
} |
FStar.HyperStack.ST.Stack | val hsalsa20:
out:lbuffer uint8 32ul
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h -> live h key /\ live h n /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.hsalsa20 (as_seq h0 key) (as_seq h0 n)) | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Salsa20",
"short_module": "Salsa20"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Spec.Salsa20",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20.Core32",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "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": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 hsalsa20 out key n =
push_frame();
let ctx = create 16ul (u32 0) in
hsalsa20_init ctx key n;
Salsa20.rounds ctx;
let r0 = ctx.(0ul) in
let r1 = ctx.(5ul) in
let r2 = ctx.(10ul) in
let r3 = ctx.(15ul) in
let r4 = ctx.(6ul) in
let r5 = ctx.(7ul) in
let r6 = ctx.(8ul) in
let r7 = ctx.(9ul) in
[@inline_let]
let res_l = [r0;r1;r2;r3;r4;r5;r6;r7] in
assert_norm (List.Tot.length res_l == 8);
let res = createL res_l in
uints_to_bytes_le #U32 8ul out res;
pop_frame() | val hsalsa20:
out:lbuffer uint8 32ul
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h -> live h key /\ live h n /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.hsalsa20 (as_seq h0 key) (as_seq h0 n))
let hsalsa20 out key n = | true | null | false | push_frame ();
let ctx = create 16ul (u32 0) in
hsalsa20_init ctx key n;
Salsa20.rounds ctx;
let r0 = ctx.(0ul) in
let r1 = ctx.(5ul) in
let r2 = ctx.(10ul) in
let r3 = ctx.(15ul) in
let r4 = ctx.(6ul) in
let r5 = ctx.(7ul) in
let r6 = ctx.(8ul) in
let r7 = ctx.(9ul) in
[@@ inline_let ]let res_l = [r0; r1; r2; r3; r4; r5; r6; r7] in
assert_norm (List.Tot.length res_l == 8);
let res = createL res_l in
uints_to_bytes_le #U32 8ul out res;
pop_frame () | {
"checked_file": "Hacl.Impl.HSalsa20.fst.checked",
"dependencies": [
"Spec.Salsa20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Salsa20.Core32.fst.checked",
"Hacl.Impl.Salsa20.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.HSalsa20.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.ByteBuffer.uints_to_bytes_le",
"Lib.IntTypes.U32",
"Lib.IntTypes.SEC",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.PUB",
"FStar.Pervasives.normalize_term",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"FStar.List.Tot.Base.length",
"Lib.Buffer.createL",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.size",
"Lib.IntTypes.size_nat",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Prims.list",
"Prims.Cons",
"Prims.Nil",
"Lib.Buffer.op_Array_Access",
"Lib.IntTypes.uint32",
"Hacl.Impl.Salsa20.rounds",
"Hacl.Impl.HSalsa20.hsalsa20_init",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u32",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.HSalsa20
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Salsa20.Core32
module ST = FStar.HyperStack.ST
module Spec = Spec.Salsa20
module Loop = Lib.LoopCombinators
module Salsa20 = Hacl.Impl.Salsa20
#set-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction
val hsalsa20_init:
ctx:state
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0))
(ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n))
let hsalsa20_init ctx k n =
let h0 = ST.get() in
push_frame();
let k32 = create 8ul (u32 0) in
let n32 = create 4ul (u32 0) in
let h0' = ST.get() in
uints_from_bytes_le k32 k;
uints_from_bytes_le n32 n;
let k0 = sub k32 0ul 4ul in
let k1 = sub k32 4ul 4ul in
ctx.(0ul) <- Spec.constant0;
update_sub #MUT ctx 1ul 4ul k0;
ctx.(5ul) <- Spec.constant1;
update_sub #MUT ctx 6ul 4ul n32;
ctx.(10ul) <- Spec.constant2;
update_sub #MUT ctx 11ul 4ul k1;
ctx.(15ul) <- Spec.constant3;
let h1' = ST.get() in
assert (modifies (loc ctx |+| loc k32 |+| loc n32) h0' h1');
pop_frame();
let h1 = ST.get() in
assert (modifies (loc ctx) h0 h1)
val hsalsa20:
out:lbuffer uint8 32ul
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h -> live h key /\ live h n /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.hsalsa20 (as_seq h0 key) (as_seq h0 n))
[@ CInline ] | false | false | Hacl.Impl.HSalsa20.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 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 hsalsa20:
out:lbuffer uint8 32ul
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h -> live h key /\ live h n /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.hsalsa20 (as_seq h0 key) (as_seq h0 n)) | [] | Hacl.Impl.HSalsa20.hsalsa20 | {
"file_name": "code/salsa20/Hacl.Impl.HSalsa20.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 86,
"start_col": 2,
"start_line": 69
} |
FStar.HyperStack.ST.Stack | val hsalsa20_init:
ctx:state
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0))
(ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n)) | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Salsa20",
"short_module": "Salsa20"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Spec.Salsa20",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20.Core32",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "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": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 hsalsa20_init ctx k n =
let h0 = ST.get() in
push_frame();
let k32 = create 8ul (u32 0) in
let n32 = create 4ul (u32 0) in
let h0' = ST.get() in
uints_from_bytes_le k32 k;
uints_from_bytes_le n32 n;
let k0 = sub k32 0ul 4ul in
let k1 = sub k32 4ul 4ul in
ctx.(0ul) <- Spec.constant0;
update_sub #MUT ctx 1ul 4ul k0;
ctx.(5ul) <- Spec.constant1;
update_sub #MUT ctx 6ul 4ul n32;
ctx.(10ul) <- Spec.constant2;
update_sub #MUT ctx 11ul 4ul k1;
ctx.(15ul) <- Spec.constant3;
let h1' = ST.get() in
assert (modifies (loc ctx |+| loc k32 |+| loc n32) h0' h1');
pop_frame();
let h1 = ST.get() in
assert (modifies (loc ctx) h0 h1) | val hsalsa20_init:
ctx:state
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0))
(ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n))
let hsalsa20_init ctx k n = | true | null | false | let h0 = ST.get () in
push_frame ();
let k32 = create 8ul (u32 0) in
let n32 = create 4ul (u32 0) in
let h0' = ST.get () in
uints_from_bytes_le k32 k;
uints_from_bytes_le n32 n;
let k0 = sub k32 0ul 4ul in
let k1 = sub k32 4ul 4ul in
ctx.(0ul) <- Spec.constant0;
update_sub #MUT ctx 1ul 4ul k0;
ctx.(5ul) <- Spec.constant1;
update_sub #MUT ctx 6ul 4ul n32;
ctx.(10ul) <- Spec.constant2;
update_sub #MUT ctx 11ul 4ul k1;
ctx.(15ul) <- Spec.constant3;
let h1' = ST.get () in
assert (modifies (loc ctx |+| loc k32 |+| loc n32) h0' h1');
pop_frame ();
let h1 = ST.get () in
assert (modifies (loc ctx) h0 h1) | {
"checked_file": "Hacl.Impl.HSalsa20.fst.checked",
"dependencies": [
"Spec.Salsa20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Salsa20.Core32.fst.checked",
"Hacl.Impl.Salsa20.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.HSalsa20.fst"
} | [] | [
"Hacl.Impl.Salsa20.Core32.state",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Prims._assert",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint32",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"FStar.HyperStack.ST.pop_frame",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U32",
"Lib.IntTypes.SEC",
"Lib.Buffer.op_Array_Assignment",
"Spec.Salsa20.constant3",
"Lib.Buffer.update_sub",
"Spec.Salsa20.constant2",
"Spec.Salsa20.constant1",
"Spec.Salsa20.constant0",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Lib.ByteBuffer.uints_from_bytes_le",
"Lib.Buffer.create",
"Lib.IntTypes.u32",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.HSalsa20
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Salsa20.Core32
module ST = FStar.HyperStack.ST
module Spec = Spec.Salsa20
module Loop = Lib.LoopCombinators
module Salsa20 = Hacl.Impl.Salsa20
#set-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction
val hsalsa20_init:
ctx:state
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0))
(ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n)) | false | false | Hacl.Impl.HSalsa20.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 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 hsalsa20_init:
ctx:state
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0))
(ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n)) | [] | Hacl.Impl.HSalsa20.hsalsa20_init | {
"file_name": "code/salsa20/Hacl.Impl.HSalsa20.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Salsa20.Core32.state ->
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 35,
"end_line": 55,
"start_col": 27,
"start_line": 34
} |
Prims.GTot | val list_as_vprop_singleton (g:env) (p q:term) (d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q])) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 list_as_vprop_singleton g
(p q:term)
(d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q]))
= VE_Ctxt _ p tm_emp q tm_emp d (VE_Refl _ tm_emp) | val list_as_vprop_singleton (g:env) (p q:term) (d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q]))
let list_as_vprop_singleton g (p: term) (q: term) (d: vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q])) = | false | null | false | VE_Ctxt _ p tm_emp q tm_emp d (VE_Refl _ tm_emp) | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.VE_Ctxt",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Typing.VE_Refl",
"Pulse.Typing.Combinators.list_as_vprop",
"Prims.Cons",
"Prims.Nil"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _
let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
= let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app'))
let list_as_vprop_singleton g
(p q:term)
(d:vprop_equiv g p q) | false | false | Pulse.Checker.VPropEquiv.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 list_as_vprop_singleton (g:env) (p q:term) (d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q])) | [] | Pulse.Checker.VPropEquiv.list_as_vprop_singleton | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
p: Pulse.Syntax.Base.term ->
q: Pulse.Syntax.Base.term ->
d: Pulse.Typing.vprop_equiv g p q
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop [p])
(Pulse.Typing.Combinators.list_as_vprop [q])) | {
"end_col": 52,
"end_line": 60,
"start_col": 4,
"start_line": 60
} |
Prims.Tot | val ve_unit_r (g:env) (p:term) : vprop_equiv g (tm_star p tm_emp) p | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) | val ve_unit_r (g:env) (p:term) : vprop_equiv g (tm_star p tm_emp) p
let ve_unit_r g (p: term) : vprop_equiv g (tm_star p tm_emp) p = | false | null | false | VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"total"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.VE_Trans",
"Pulse.Syntax.Base.tm_star",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Typing.VE_Comm",
"Pulse.Typing.VE_Unit",
"Pulse.Typing.vprop_equiv"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot | false | false | Pulse.Checker.VPropEquiv.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 ve_unit_r (g:env) (p:term) : vprop_equiv g (tm_star p tm_emp) p | [] | Pulse.Checker.VPropEquiv.ve_unit_r | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | g: Pulse.Typing.Env.env -> p: Pulse.Syntax.Base.term
-> Pulse.Typing.vprop_equiv g (Pulse.Syntax.Base.tm_star p Pulse.Syntax.Base.tm_emp) p | {
"end_col": 48,
"end_line": 7,
"start_col": 2,
"start_line": 7
} |
Prims.GTot | val list_as_vprop_comm (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0))) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2 | val list_as_vprop_comm (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
let list_as_vprop_comm g (vp0: list term) (vp1: list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp1 @ vp0))) = | false | null | false | let d1:_ = list_as_vprop_append g vp0 vp1 in
let d2:_ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1:_ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2 | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Typing.VE_Trans",
"Pulse.Typing.Combinators.list_as_vprop",
"FStar.List.Tot.Base.op_At",
"Pulse.Syntax.Base.tm_star",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.VE_Comm",
"Pulse.Typing.VE_Sym",
"Pulse.Checker.VPropEquiv.list_as_vprop_append"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) | false | false | Pulse.Checker.VPropEquiv.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 list_as_vprop_comm (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0))) | [] | Pulse.Checker.VPropEquiv.list_as_vprop_comm | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
vp0: Prims.list Pulse.Syntax.Base.term ->
vp1: Prims.list Pulse.Syntax.Base.term
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1))
(Pulse.Typing.Combinators.list_as_vprop (vp1 @ vp0))) | {
"end_col": 26,
"end_line": 38,
"start_col": 3,
"start_line": 35
} |
Prims.GTot | val list_as_vprop_ctx (g:env) (vp0 vp0' vp1 vp1':list term)
(_:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(_:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
= let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app')) | val list_as_vprop_ctx (g:env) (vp0 vp0' vp1 vp1':list term)
(_:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(_:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
let list_as_vprop_ctx
g
(vp0: list term)
(vp0': list term)
(vp1: list term)
(vp1': list term)
(d0: vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1: vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) = | false | null | false | let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app')) | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.Combinators.list_as_vprop",
"Pulse.Typing.VE_Trans",
"FStar.List.Tot.Base.op_At",
"Pulse.Syntax.Base.tm_star",
"Pulse.Typing.VE_Sym",
"Pulse.Typing.VE_Ctxt",
"Pulse.Checker.VPropEquiv.list_as_vprop_append"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _
let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) | false | false | Pulse.Checker.VPropEquiv.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 list_as_vprop_ctx (g:env) (vp0 vp0' vp1 vp1':list term)
(_:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(_:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) | [] | Pulse.Checker.VPropEquiv.list_as_vprop_ctx | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
vp0: Prims.list Pulse.Syntax.Base.term ->
vp0': Prims.list Pulse.Syntax.Base.term ->
vp1: Prims.list Pulse.Syntax.Base.term ->
vp1': Prims.list Pulse.Syntax.Base.term ->
d0:
Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop vp0)
(Pulse.Typing.Combinators.list_as_vprop vp0') ->
d1:
Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop vp1)
(Pulse.Typing.Combinators.list_as_vprop vp1')
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1))
(Pulse.Typing.Combinators.list_as_vprop (vp0' @ vp1'))) | {
"end_col": 80,
"end_line": 54,
"start_col": 3,
"start_line": 51
} |
Prims.GTot | val vprop_equiv_swap_equiv (g:_) (l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([p] @ (l0 @ l2)))) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 vprop_equiv_swap_equiv (g:_)
(l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([p] @ (l0 @ l2)))
= let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop (([q] @ l0) @ l2))
= list_as_vprop_ctx g (l0 @ [q]) ([q] @ l0) l2 l2
(list_as_vprop_comm g l0 [q])
(VE_Refl _ _) in
let d' : vprop_equiv g (list_as_vprop (([q] @ l0) @ l2))
(list_as_vprop ([q] @ (l0 @ l2)))
= List.Tot.append_assoc [q] l0 l2;
VE_Refl _ _ in
let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([q] @ (l0 @ l2)))
= VE_Trans _ _ _ _ d d' in
let d_q_p = VE_Sym _ _ _ d_p_q in
let d' : vprop_equiv g (list_as_vprop [q]) (list_as_vprop [p]) =
list_as_vprop_singleton _ _ _ d_q_p in
let d' : vprop_equiv g (list_as_vprop ([q] @ (l0 @ l2)))
(list_as_vprop ([p] @ (l0 @ l2)))
= list_as_vprop_ctx g [q] [p] (l0 @ l2) _ d' (VE_Refl _ _) in
VE_Trans _ _ _ _ d d' | val vprop_equiv_swap_equiv (g:_) (l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([p] @ (l0 @ l2))))
let vprop_equiv_swap_equiv (g: _) (l0 l2: list term) (p q: term) (d_p_q: vprop_equiv g p q)
: vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop ([p] @ (l0 @ l2))) = | false | null | false | let d:vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop (([q] @ l0) @ l2)) =
list_as_vprop_ctx g (l0 @ [q]) ([q] @ l0) l2 l2 (list_as_vprop_comm g l0 [q]) (VE_Refl _ _)
in
let d':vprop_equiv g (list_as_vprop (([q] @ l0) @ l2)) (list_as_vprop ([q] @ (l0 @ l2))) =
List.Tot.append_assoc [q] l0 l2;
VE_Refl _ _
in
let d:vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop ([q] @ (l0 @ l2))) =
VE_Trans _ _ _ _ d d'
in
let d_q_p = VE_Sym _ _ _ d_p_q in
let d':vprop_equiv g (list_as_vprop [q]) (list_as_vprop [p]) =
list_as_vprop_singleton _ _ _ d_q_p
in
let d':vprop_equiv g (list_as_vprop ([q] @ (l0 @ l2))) (list_as_vprop ([p] @ (l0 @ l2))) =
list_as_vprop_ctx g [q] [p] (l0 @ l2) _ d' (VE_Refl _ _)
in
VE_Trans _ _ _ _ d d' | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.VE_Trans",
"Pulse.Typing.Combinators.list_as_vprop",
"FStar.List.Tot.Base.op_At",
"Prims.Cons",
"Prims.Nil",
"Pulse.Checker.VPropEquiv.list_as_vprop_ctx",
"Pulse.Typing.VE_Refl",
"Pulse.Checker.VPropEquiv.list_as_vprop_singleton",
"Pulse.Typing.VE_Sym",
"Prims.unit",
"FStar.List.Tot.Properties.append_assoc",
"Pulse.Checker.VPropEquiv.list_as_vprop_comm"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _
let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
= let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app'))
let list_as_vprop_singleton g
(p q:term)
(d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q]))
= VE_Ctxt _ p tm_emp q tm_emp d (VE_Refl _ tm_emp)
let rec vprop_list_equiv (g:env)
(vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp))
(decreases vp)
= match vp.t with
| Tm_Emp -> VE_Refl _ _
| Tm_Star vp0 vp1 ->
let eq0 = vprop_list_equiv g vp0 in
let eq1 = vprop_list_equiv g vp1 in
let app_eq
: vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1))
= list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)
in
let step
: vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1))
= VE_Ctxt _ _ _ _ _ eq0 eq1
in
VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)
| _ ->
VE_Sym _ _ _
(VE_Trans _ _ _ _ (VE_Comm g vp tm_emp) (VE_Unit _ vp))
let vprop_equiv_swap_equiv (g:_)
(l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) | false | false | Pulse.Checker.VPropEquiv.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 vprop_equiv_swap_equiv (g:_) (l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([p] @ (l0 @ l2)))) | [] | Pulse.Checker.VPropEquiv.vprop_equiv_swap_equiv | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
l0: Prims.list Pulse.Syntax.Base.term ->
l2: Prims.list Pulse.Syntax.Base.term ->
p: Pulse.Syntax.Base.term ->
q: Pulse.Syntax.Base.term ->
d_p_q: Pulse.Typing.vprop_equiv g p q
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop ((l0 @ [q]) @ l2))
(Pulse.Typing.Combinators.list_as_vprop ([p] @ l0 @ l2))) | {
"end_col": 25,
"end_line": 108,
"start_col": 3,
"start_line": 90
} |
Prims.GTot | val list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2))) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _ | val list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
let list_as_vprop_assoc g (vp0: list term) (vp1: list term) (vp2: list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2))) = | false | null | false | List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _ | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Typing.VE_Refl",
"Pulse.Typing.Combinators.list_as_vprop",
"FStar.List.Tot.Base.op_At",
"Prims.unit",
"FStar.List.Tot.Properties.append_assoc",
"Pulse.Typing.vprop_equiv"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) | false | false | Pulse.Checker.VPropEquiv.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 list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2))) | [] | Pulse.Checker.VPropEquiv.list_as_vprop_assoc | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
vp0: Prims.list Pulse.Syntax.Base.term ->
vp1: Prims.list Pulse.Syntax.Base.term ->
vp2: Prims.list Pulse.Syntax.Base.term
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1 @ vp2))
(Pulse.Typing.Combinators.list_as_vprop ((vp0 @ vp1) @ vp2))) | {
"end_col": 15,
"end_line": 44,
"start_col": 4,
"start_line": 43
} |
Prims.Tot | val vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term)
(d:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt)))
: vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term)
(veq:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt)))
: vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt
= let ctxt_l = vprop_as_list ctxt in
let req_l = vprop_as_list req in
let veq : vprop_equiv g (list_as_vprop (req_l @ frame))
(list_as_vprop ctxt_l) = veq in
let d1
: vprop_equiv _ (tm_star (canon_vprop req) (list_as_vprop frame))
(list_as_vprop (req_l @ frame))
= VE_Sym _ _ _ (list_as_vprop_append g req_l frame)
in
let d1
: vprop_equiv _ (tm_star req (list_as_vprop frame))
(list_as_vprop (req_l @ frame))
= VE_Trans _ _ _ _ (VE_Ctxt _ _ _ _ _ (vprop_list_equiv g req) (VE_Refl _ _)) d1
in
let d : vprop_equiv _ (tm_star req (list_as_vprop frame))
(canon_vprop ctxt) =
VE_Trans _ _ _ _ d1 veq
in
let d : vprop_equiv _ (tm_star req (list_as_vprop frame))
ctxt =
VE_Trans _ _ _ _ d (VE_Sym _ _ _ (vprop_list_equiv g ctxt))
in
d | val vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term)
(d:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt)))
: vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt
let vprop_equiv_split_frame
(g: _)
(ctxt req: term)
(frame: list term)
(veq:
vprop_equiv g
(list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt)))
: vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt = | false | null | false | let ctxt_l = vprop_as_list ctxt in
let req_l = vprop_as_list req in
let veq:vprop_equiv g (list_as_vprop (req_l @ frame)) (list_as_vprop ctxt_l) = veq in
let d1:vprop_equiv _
(tm_star (canon_vprop req) (list_as_vprop frame))
(list_as_vprop (req_l @ frame)) =
VE_Sym _ _ _ (list_as_vprop_append g req_l frame)
in
let d1:vprop_equiv _ (tm_star req (list_as_vprop frame)) (list_as_vprop (req_l @ frame)) =
VE_Trans _ _ _ _ (VE_Ctxt _ _ _ _ _ (vprop_list_equiv g req) (VE_Refl _ _)) d1
in
let d:vprop_equiv _ (tm_star req (list_as_vprop frame)) (canon_vprop ctxt) =
VE_Trans _ _ _ _ d1 veq
in
let d:vprop_equiv _ (tm_star req (list_as_vprop frame)) ctxt =
VE_Trans _ _ _ _ d (VE_Sym _ _ _ (vprop_list_equiv g ctxt))
in
d | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"total"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Prims.list",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.Combinators.list_as_vprop",
"FStar.List.Tot.Base.op_At",
"Pulse.Typing.Combinators.vprop_as_list",
"Pulse.Syntax.Base.tm_star",
"Pulse.Typing.VE_Trans",
"Pulse.Checker.VPropEquiv.canon_vprop",
"Pulse.Typing.VE_Sym",
"Pulse.Checker.VPropEquiv.vprop_list_equiv",
"Pulse.Typing.VE_Ctxt",
"Pulse.Typing.VE_Refl",
"Pulse.Checker.VPropEquiv.list_as_vprop_append"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _
let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
= let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app'))
let list_as_vprop_singleton g
(p q:term)
(d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q]))
= VE_Ctxt _ p tm_emp q tm_emp d (VE_Refl _ tm_emp)
let rec vprop_list_equiv (g:env)
(vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp))
(decreases vp)
= match vp.t with
| Tm_Emp -> VE_Refl _ _
| Tm_Star vp0 vp1 ->
let eq0 = vprop_list_equiv g vp0 in
let eq1 = vprop_list_equiv g vp1 in
let app_eq
: vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1))
= list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)
in
let step
: vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1))
= VE_Ctxt _ _ _ _ _ eq0 eq1
in
VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)
| _ ->
VE_Sym _ _ _
(VE_Trans _ _ _ _ (VE_Comm g vp tm_emp) (VE_Unit _ vp))
let vprop_equiv_swap_equiv (g:_)
(l0 l2:list term)
(p q:term) (d_p_q:vprop_equiv g p q)
: vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([p] @ (l0 @ l2)))
= let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop (([q] @ l0) @ l2))
= list_as_vprop_ctx g (l0 @ [q]) ([q] @ l0) l2 l2
(list_as_vprop_comm g l0 [q])
(VE_Refl _ _) in
let d' : vprop_equiv g (list_as_vprop (([q] @ l0) @ l2))
(list_as_vprop ([q] @ (l0 @ l2)))
= List.Tot.append_assoc [q] l0 l2;
VE_Refl _ _ in
let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2))
(list_as_vprop ([q] @ (l0 @ l2)))
= VE_Trans _ _ _ _ d d' in
let d_q_p = VE_Sym _ _ _ d_p_q in
let d' : vprop_equiv g (list_as_vprop [q]) (list_as_vprop [p]) =
list_as_vprop_singleton _ _ _ d_q_p in
let d' : vprop_equiv g (list_as_vprop ([q] @ (l0 @ l2)))
(list_as_vprop ([p] @ (l0 @ l2)))
= list_as_vprop_ctx g [q] [p] (l0 @ l2) _ d' (VE_Refl _ _) in
VE_Trans _ _ _ _ d d'
let vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term)
(veq:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt))) | false | false | Pulse.Checker.VPropEquiv.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 vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term)
(d:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame))
(list_as_vprop (vprop_as_list ctxt)))
: vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt | [] | Pulse.Checker.VPropEquiv.vprop_equiv_split_frame | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
ctxt: Pulse.Syntax.Base.term ->
req: Pulse.Syntax.Base.term ->
frame: Prims.list Pulse.Syntax.Base.term ->
d:
Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop (Pulse.Typing.Combinators.vprop_as_list req @ frame)
)
(Pulse.Typing.Combinators.list_as_vprop (Pulse.Typing.Combinators.vprop_as_list ctxt))
-> Pulse.Typing.vprop_equiv g
(Pulse.Syntax.Base.tm_star req (Pulse.Typing.Combinators.list_as_vprop frame))
ctxt | {
"end_col": 5,
"end_line": 137,
"start_col": 3,
"start_line": 115
} |
Prims.GTot | val list_as_vprop_append (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1))) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d | val list_as_vprop_append (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
let rec list_as_vprop_append g (vp0: list term) (vp1: list term)
: GTot
(vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1)))
(decreases vp0) = | false | null | false | match vp0 with
| [] ->
let v:vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) =
VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd :: tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d:vprop_equiv g
(list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) =
VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d:vprop_equiv g
(list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) =
VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _)
in
d | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"",
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.Combinators.list_as_vprop",
"Pulse.Syntax.Base.tm_star",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Typing.VE_Sym",
"Pulse.Typing.VE_Unit",
"FStar.List.Tot.Base.op_At",
"Pulse.Typing.VE_Trans",
"Pulse.Typing.VE_Assoc",
"Pulse.Typing.VE_Ctxt",
"Pulse.Typing.VE_Refl",
"Pulse.Checker.VPropEquiv.list_as_vprop_append"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1))) | false | false | Pulse.Checker.VPropEquiv.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 list_as_vprop_append (g:env) (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1))) | [
"recursion"
] | Pulse.Checker.VPropEquiv.list_as_vprop_append | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
vp0: Prims.list Pulse.Syntax.Base.term ->
vp1: Prims.list Pulse.Syntax.Base.term
-> Prims.GTot
(Pulse.Typing.vprop_equiv g
(Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1))
(Pulse.Syntax.Base.tm_star (Pulse.Typing.Combinators.list_as_vprop vp0)
(Pulse.Typing.Combinators.list_as_vprop vp1))) | {
"end_col": 7,
"end_line": 29,
"start_col": 4,
"start_line": 14
} |
Prims.GTot | val vprop_list_equiv (g:env) (vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp)) | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 vprop_list_equiv (g:env)
(vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp))
(decreases vp)
= match vp.t with
| Tm_Emp -> VE_Refl _ _
| Tm_Star vp0 vp1 ->
let eq0 = vprop_list_equiv g vp0 in
let eq1 = vprop_list_equiv g vp1 in
let app_eq
: vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1))
= list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)
in
let step
: vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1))
= VE_Ctxt _ _ _ _ _ eq0 eq1
in
VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)
| _ ->
VE_Sym _ _ _
(VE_Trans _ _ _ _ (VE_Comm g vp tm_emp) (VE_Unit _ vp)) | val vprop_list_equiv (g:env) (vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp))
let rec vprop_list_equiv (g: env) (vp: term)
: GTot (vprop_equiv g vp (canon_vprop vp)) (decreases vp) = | false | null | false | match vp.t with
| Tm_Emp -> VE_Refl _ _
| Tm_Star vp0 vp1 ->
let eq0 = vprop_list_equiv g vp0 in
let eq1 = vprop_list_equiv g vp1 in
let app_eq:vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1)) =
list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)
in
let step:vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1)) =
VE_Ctxt _ _ _ _ _ eq0 eq1
in
VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)
| _ -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g vp tm_emp) (VE_Unit _ vp)) | {
"checked_file": "Pulse.Checker.VPropEquiv.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.VPropEquiv.fst"
} | [
"",
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Pulse.Typing.VE_Refl",
"Pulse.Typing.VE_Trans",
"Pulse.Syntax.Base.tm_star",
"Pulse.Checker.VPropEquiv.canon_vprop",
"Pulse.Typing.VE_Sym",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.VE_Ctxt",
"Pulse.Checker.VPropEquiv.list_as_vprop_append",
"Pulse.Typing.Combinators.vprop_as_list",
"Pulse.Checker.VPropEquiv.vprop_list_equiv",
"Pulse.Syntax.Base.term'",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Typing.VE_Comm",
"Pulse.Typing.VE_Unit"
] | [] | module Pulse.Checker.VPropEquiv
open Pulse.Syntax
open Pulse.Typing
open FStar.List.Tot
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let rec list_as_vprop_append g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (list_as_vprop vp0)
(list_as_vprop vp1)))
(decreases vp0)
= match vp0 with
| [] ->
let v : vprop_equiv g (list_as_vprop vp1)
(tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _)
in
v
| hd::tl ->
let tl_vp1 = list_as_vprop_append g tl vp1 in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1)))
= VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1
in
let d : vprop_equiv g (list_as_vprop (vp0 @ vp1))
(tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1))
= VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in
d
let list_as_vprop_comm g (vp0 vp1:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1))
(list_as_vprop (vp1 @ vp0)))
= let d1 : _ = list_as_vprop_append g vp0 vp1 in
let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in
let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in
VE_Trans _ _ _ _ d1 d2
let list_as_vprop_assoc g (vp0 vp1 vp2:list term)
: GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))
(list_as_vprop ((vp0 @ vp1) @ vp2)))
= List.Tot.append_assoc vp0 vp1 vp2;
VE_Refl _ _
let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)
(d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))
(d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))
: GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))
= let split_app = list_as_vprop_append _ vp0 vp1 in
let split_app' = list_as_vprop_append _ vp0' vp1' in
let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in
VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app'))
let list_as_vprop_singleton g
(p q:term)
(d:vprop_equiv g p q)
: GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q]))
= VE_Ctxt _ p tm_emp q tm_emp d (VE_Refl _ tm_emp)
let rec vprop_list_equiv (g:env)
(vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp)) | false | false | Pulse.Checker.VPropEquiv.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 vprop_list_equiv (g:env) (vp:term)
: GTot (vprop_equiv g vp (canon_vprop vp)) | [
"recursion"
] | Pulse.Checker.VPropEquiv.vprop_list_equiv | {
"file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | g: Pulse.Typing.Env.env -> vp: Pulse.Syntax.Base.term
-> Prims.GTot (Pulse.Typing.vprop_equiv g vp (Pulse.Checker.VPropEquiv.canon_vprop vp)) | {
"end_col": 63,
"end_line": 83,
"start_col": 4,
"start_line": 66
} |
Prims.Tot | val width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8 | val width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes
let width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes = | false | null | false | match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8 | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Spec.Chacha20.Vec.lanes"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract | false | true | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes | [] | Hacl.Impl.Chacha20Poly1305.width_chacha20 | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: Hacl.Impl.Poly1305.Fields.field_spec -> Hacl.Spec.Chacha20.Vec.lanes | {
"end_col": 13,
"end_line": 111,
"start_col": 2,
"start_line": 108
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad)) | let poly1305_do_core_st (w: field_spec) = | false | null | false |
k: lbuffer uint8 32ul ->
aadlen: size_t ->
aad: lbuffer uint8 aadlen ->
mlen: size_t ->
m: lbuffer uint8 mlen ->
out: lbuffer uint8 16ul
-> Stack unit
(requires fun h -> live h k /\ live h aad /\ live h m /\ live h out /\ disjoint k out)
(ensures
fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad)) | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Spec.Chacha20Poly1305.poly1305_do"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract | false | true | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_do_core_st : w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | [] | Hacl.Impl.Chacha20Poly1305.poly1305_do_core_st | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | {
"end_col": 82,
"end_line": 91,
"start_col": 4,
"start_line": 79
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 aead_encrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> tag:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h tag /\
disjoint key output /\ disjoint nonce output /\
disjoint key tag /\ disjoint nonce tag /\
disjoint output tag /\ eq_or_disjoint input output /\
disjoint aad output)
(ensures fun h0 _ h1 -> modifies2 output tag h0 h1 /\
Seq.append (as_seq h1 output) (as_seq h1 tag) ==
Spec.aead_encrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 input) (as_seq h0 aad)) | let aead_encrypt_st (w: field_spec) = | false | null | false |
key: lbuffer uint8 32ul ->
nonce: lbuffer uint8 12ul ->
alen: size_t ->
aad: lbuffer uint8 alen ->
len: size_t ->
input: lbuffer uint8 len ->
output: lbuffer uint8 len ->
tag: lbuffer uint8 16ul
-> Stack unit
(requires
fun h ->
live h key /\ live h nonce /\ live h aad /\ live h input /\ live h output /\ live h tag /\
disjoint key output /\ disjoint nonce output /\ disjoint key tag /\ disjoint nonce tag /\
disjoint output tag /\ eq_or_disjoint input output /\ disjoint aad output)
(ensures
fun h0 _ h1 ->
modifies2 output tag h0 h1 /\
Seq.append (as_seq h1 output) (as_seq h1 tag) ==
Spec.aead_encrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 input) (as_seq h0 aad)) | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.disjoint",
"Lib.Buffer.eq_or_disjoint",
"Lib.Buffer.modifies2",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.append",
"Lib.Buffer.as_seq",
"Spec.Chacha20Poly1305.aead_encrypt"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8
[@ Meta.Attribute.specialize ]
assume val chacha20_encrypt: #w:field_spec ->
Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st (width_chacha20 w)
// Derives the key, and then perform poly1305
val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
[@ Meta.Attribute.inline_ ]
let derive_key_poly1305_do #w k n aadlen aad mlen m out =
push_frame ();
// Create a new buffer to derive the key
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
// The derived key should only be the first 32 bytes
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame()
inline_for_extraction noextract | false | true | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_encrypt_st : w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | [] | Hacl.Impl.Chacha20Poly1305.aead_encrypt_st | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | {
"end_col": 90,
"end_line": 164,
"start_col": 4,
"start_line": 146
} |
|
Prims.Tot | val aead_encrypt: #w:field_spec -> aead_encrypt_st w | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 aead_encrypt #w k n aadlen aad mlen m cipher mac =
chacha20_encrypt #w mlen cipher m k n 1ul;
derive_key_poly1305_do #w k n aadlen aad mlen cipher mac | val aead_encrypt: #w:field_spec -> aead_encrypt_st w
let aead_encrypt #w k n aadlen aad mlen m cipher mac = | false | null | false | chacha20_encrypt #w mlen cipher m k n 1ul;
derive_key_poly1305_do #w k n aadlen aad mlen cipher mac | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Hacl.Impl.Chacha20Poly1305.derive_key_poly1305_do",
"Prims.unit",
"Hacl.Impl.Chacha20Poly1305.chacha20_encrypt"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8
[@ Meta.Attribute.specialize ]
assume val chacha20_encrypt: #w:field_spec ->
Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st (width_chacha20 w)
// Derives the key, and then perform poly1305
val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
[@ Meta.Attribute.inline_ ]
let derive_key_poly1305_do #w k n aadlen aad mlen m out =
push_frame ();
// Create a new buffer to derive the key
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
// The derived key should only be the first 32 bytes
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame()
inline_for_extraction noextract
let aead_encrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> tag:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h tag /\
disjoint key output /\ disjoint nonce output /\
disjoint key tag /\ disjoint nonce tag /\
disjoint output tag /\ eq_or_disjoint input output /\
disjoint aad output)
(ensures fun h0 _ h1 -> modifies2 output tag h0 h1 /\
Seq.append (as_seq h1 output) (as_seq h1 tag) ==
Spec.aead_encrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 input) (as_seq h0 aad))
noextract
val aead_encrypt: #w:field_spec -> aead_encrypt_st w
[@ Meta.Attribute.specialize ] | false | false | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_encrypt: #w:field_spec -> aead_encrypt_st w | [] | Hacl.Impl.Chacha20Poly1305.aead_encrypt | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Chacha20Poly1305.aead_encrypt_st w | {
"end_col": 58,
"end_line": 172,
"start_col": 2,
"start_line": 171
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 aead_decrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> mac:lbuffer uint8 16ul ->
Stack UInt32.t
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h mac /\
eq_or_disjoint input output)
(ensures fun h0 z h1 -> modifies1 input h0 h1 /\
(let plain = Spec.aead_decrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 output) (as_seq h0 mac) (as_seq h0 aad) in
match z with
| 0ul -> Some? plain /\ as_seq h1 input == Some?.v plain // decryption succeeded
| 1ul -> None? plain
| _ -> false) // decryption failed
) | let aead_decrypt_st (w: field_spec) = | false | null | false |
key: lbuffer uint8 32ul ->
nonce: lbuffer uint8 12ul ->
alen: size_t ->
aad: lbuffer uint8 alen ->
len: size_t ->
input: lbuffer uint8 len ->
output: lbuffer uint8 len ->
mac: lbuffer uint8 16ul
-> Stack UInt32.t
(requires
fun h ->
live h key /\ live h nonce /\ live h aad /\ live h input /\ live h output /\ live h mac /\
eq_or_disjoint input output)
(ensures
fun h0 z h1 ->
modifies1 input h0 h1 /\
(let plain =
Spec.aead_decrypt (as_seq h0 key)
(as_seq h0 nonce)
(as_seq h0 output)
(as_seq h0 mac)
(as_seq h0 aad)
in
match z with
| 0ul -> Some? plain /\ as_seq h1 input == Some?.v plain
| 1ul -> None? plain
| _ -> false)) | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.UInt32.t",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.eq_or_disjoint",
"Lib.Buffer.modifies1",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"Lib.ByteSequence.lbytes",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Prims.eq2",
"Lib.Sequence.seq",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.Pervasives.Native.__proj__Some__item__v",
"FStar.Pervasives.Native.uu___is_None",
"Prims.logical",
"FStar.Pervasives.Native.option",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Spec.Chacha20Poly1305.aead_decrypt"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8
[@ Meta.Attribute.specialize ]
assume val chacha20_encrypt: #w:field_spec ->
Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st (width_chacha20 w)
// Derives the key, and then perform poly1305
val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
[@ Meta.Attribute.inline_ ]
let derive_key_poly1305_do #w k n aadlen aad mlen m out =
push_frame ();
// Create a new buffer to derive the key
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
// The derived key should only be the first 32 bytes
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame()
inline_for_extraction noextract
let aead_encrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> tag:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h tag /\
disjoint key output /\ disjoint nonce output /\
disjoint key tag /\ disjoint nonce tag /\
disjoint output tag /\ eq_or_disjoint input output /\
disjoint aad output)
(ensures fun h0 _ h1 -> modifies2 output tag h0 h1 /\
Seq.append (as_seq h1 output) (as_seq h1 tag) ==
Spec.aead_encrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 input) (as_seq h0 aad))
noextract
val aead_encrypt: #w:field_spec -> aead_encrypt_st w
[@ Meta.Attribute.specialize ]
let aead_encrypt #w k n aadlen aad mlen m cipher mac =
chacha20_encrypt #w mlen cipher m k n 1ul;
derive_key_poly1305_do #w k n aadlen aad mlen cipher mac
inline_for_extraction noextract | false | true | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_decrypt_st : w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | [] | Hacl.Impl.Chacha20Poly1305.aead_decrypt_st | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | {
"end_col": 3,
"end_line": 197,
"start_col": 4,
"start_line": 178
} |
|
Prims.Tot | val poly1305_do: #w:field_spec -> poly1305_do_core_st w | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame() | val poly1305_do: #w:field_spec -> poly1305_do_core_st w
let poly1305_do #w k aadlen aad mlen m out = | false | null | false | push_frame ();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Poly1305.poly1305_finish",
"Hacl.Impl.Chacha20Poly1305.poly1305_do_",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Hacl.Spec.Poly1305.Field32xN.uint64xN",
"Lib.IntTypes.add",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Impl.Poly1305.Fields.limb",
"Lib.IntTypes.op_Plus_Bang",
"Hacl.Impl.Poly1305.Fields.nlimb",
"Hacl.Impl.Poly1305.Fields.precomplen",
"Hacl.Impl.Poly1305.Fields.limb_zero",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize] | false | false | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_do: #w:field_spec -> poly1305_do_core_st w | [] | Hacl.Impl.Chacha20Poly1305.poly1305_do | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Chacha20Poly1305.poly1305_do_core_st w | {
"end_col": 13,
"end_line": 103,
"start_col": 2,
"start_line": 98
} |
FStar.HyperStack.ST.Stack | val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad))) | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 derive_key_poly1305_do #w k n aadlen aad mlen m out =
push_frame ();
// Create a new buffer to derive the key
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
// The derived key should only be the first 32 bytes
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame() | val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
let derive_key_poly1305_do #w k n aadlen aad mlen m out = | true | null | false | push_frame ();
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Chacha20Poly1305.poly1305_do",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Hacl.Impl.Chacha20Poly1305.chacha20_encrypt",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8
[@ Meta.Attribute.specialize ]
assume val chacha20_encrypt: #w:field_spec ->
Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st (width_chacha20 w)
// Derives the key, and then perform poly1305
val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad))) | [] | Hacl.Impl.Chacha20Poly1305.derive_key_poly1305_do | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
aadlen: Lib.IntTypes.size_t ->
aad: Lib.Buffer.lbuffer Lib.IntTypes.uint8 aadlen ->
mlen: Lib.IntTypes.size_t ->
m: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 142,
"start_col": 2,
"start_line": 135
} |
Prims.Tot | val aead_decrypt: #w:field_spec -> aead_decrypt_st w | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 aead_decrypt #w k n aadlen aad mlen m cipher mac =
push_frame();
let h0 = ST.get() in
// Create a buffer to store the temporary mac
let computed_mac = create 16ul (u8 0) in
// Compute the expected mac using Poly1305
derive_key_poly1305_do #w k n aadlen aad mlen cipher computed_mac;
let h1 = ST.get() in
let res =
if lbytes_eq computed_mac mac then (
assert (BSeq.lbytes_eq (as_seq h1 computed_mac) (as_seq h1 mac));
// If the computed mac matches the mac given, decrypt the ciphertext and return 0
chacha20_encrypt #w mlen m cipher k n 1ul;
0ul
) else 1ul // Macs do not agree, do not decrypt
in
pop_frame();
res | val aead_decrypt: #w:field_spec -> aead_decrypt_st w
let aead_decrypt #w k n aadlen aad mlen m cipher mac = | false | null | false | push_frame ();
let h0 = ST.get () in
let computed_mac = create 16ul (u8 0) in
derive_key_poly1305_do #w k n aadlen aad mlen cipher computed_mac;
let h1 = ST.get () in
let res =
if lbytes_eq computed_mac mac
then
(assert (BSeq.lbytes_eq (as_seq h1 computed_mac) (as_seq h1 mac));
chacha20_encrypt #w mlen m cipher k n 1ul;
0ul)
else 1ul
in
pop_frame ();
res | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.UInt32.t",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Impl.Chacha20Poly1305.chacha20_encrypt",
"Prims._assert",
"Prims.b2t",
"Lib.ByteSequence.lbytes_eq",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.bool",
"Lib.ByteBuffer.lbytes_eq",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Chacha20Poly1305.derive_key_poly1305_do",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_]
let poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block
// Implements the actual poly1305_do operation
inline_for_extraction noextract
let poly1305_do_core_st (w:field_spec) =
k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> out:lbuffer uint8 16ul -> // output: tag
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h out /\
disjoint k out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
noextract
val poly1305_do: #w:field_spec -> poly1305_do_core_st w
[@Meta.Attribute.specialize]
let poly1305_do #w k aadlen aad mlen m out =
push_frame();
let ctx = create (nlimb w +! precomplen w) (limb_zero w) in
let block = create 16ul (u8 0) in
poly1305_do_ #w k aadlen aad mlen m ctx block;
Poly.poly1305_finish out k ctx;
pop_frame()
unfold noextract
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with
| M32 -> 1
| M128 -> 4
| M256 -> 8
[@ Meta.Attribute.specialize ]
assume val chacha20_encrypt: #w:field_spec ->
Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st (width_chacha20 w)
// Derives the key, and then perform poly1305
val derive_key_poly1305_do:
#w:field_spec
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen
-> mlen:size_t
-> m:lbuffer uint8 mlen
-> out:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h n /\ live h aad /\ live h m /\ live h out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
(let key:LSeq.lseq uint8 64 = Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 k) (as_seq h0 n) 0 (LSeq.create 64 (u8 0)) in
as_seq h1 out == Spec.poly1305_do (LSeq.sub key 0 32) (as_seq h0 m) (as_seq h0 aad)))
[@ Meta.Attribute.inline_ ]
let derive_key_poly1305_do #w k n aadlen aad mlen m out =
push_frame ();
// Create a new buffer to derive the key
let tmp = create 64ul (u8 0) in
chacha20_encrypt #w 64ul tmp tmp k n 0ul;
// The derived key should only be the first 32 bytes
let key = sub tmp 0ul 32ul in
poly1305_do #w key aadlen aad mlen m out;
pop_frame()
inline_for_extraction noextract
let aead_encrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> tag:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h tag /\
disjoint key output /\ disjoint nonce output /\
disjoint key tag /\ disjoint nonce tag /\
disjoint output tag /\ eq_or_disjoint input output /\
disjoint aad output)
(ensures fun h0 _ h1 -> modifies2 output tag h0 h1 /\
Seq.append (as_seq h1 output) (as_seq h1 tag) ==
Spec.aead_encrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 input) (as_seq h0 aad))
noextract
val aead_encrypt: #w:field_spec -> aead_encrypt_st w
[@ Meta.Attribute.specialize ]
let aead_encrypt #w k n aadlen aad mlen m cipher mac =
chacha20_encrypt #w mlen cipher m k n 1ul;
derive_key_poly1305_do #w k n aadlen aad mlen cipher mac
inline_for_extraction noextract
let aead_decrypt_st (w:field_spec) =
key:lbuffer uint8 32ul
-> nonce:lbuffer uint8 12ul
-> alen:size_t
-> aad:lbuffer uint8 alen
-> len:size_t
-> input:lbuffer uint8 len
-> output:lbuffer uint8 len
-> mac:lbuffer uint8 16ul ->
Stack UInt32.t
(requires fun h ->
live h key /\ live h nonce /\ live h aad /\
live h input /\ live h output /\ live h mac /\
eq_or_disjoint input output)
(ensures fun h0 z h1 -> modifies1 input h0 h1 /\
(let plain = Spec.aead_decrypt (as_seq h0 key) (as_seq h0 nonce) (as_seq h0 output) (as_seq h0 mac) (as_seq h0 aad) in
match z with
| 0ul -> Some? plain /\ as_seq h1 input == Some?.v plain // decryption succeeded
| 1ul -> None? plain
| _ -> false) // decryption failed
)
noextract
val aead_decrypt: #w:field_spec -> aead_decrypt_st w
[@ Meta.Attribute.specialize ] | false | false | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_decrypt: #w:field_spec -> aead_decrypt_st w | [] | Hacl.Impl.Chacha20Poly1305.aead_decrypt | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Chacha20Poly1305.aead_decrypt_st w | {
"end_col": 5,
"end_line": 221,
"start_col": 2,
"start_line": 205
} |
FStar.HyperStack.ST.Stack | val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx)) | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "Poly"
},
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "SpecPoly"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": 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 poly1305_do_ #w k aadlen aad mlen m ctx block =
Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (
poly1305_padded ctx aadlen aad)
else ();
if (mlen <> 0ul) then (
poly1305_padded ctx mlen m)
else ();
let h0 = ST.get () in
update_sub_f h0 block 0ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
//assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1 block 8ul 8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
//assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen));
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block);
//assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)));
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block | val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
let poly1305_do_ #w k aadlen aad mlen m ctx block = | true | null | false | Poly.poly1305_init ctx k;
if (aadlen <> 0ul) then (poly1305_padded ctx aadlen aad);
if (mlen <> 0ul) then (poly1305_padded ctx mlen m);
let h0 = ST.get () in
update_sub_f h0
block
0ul
8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
(fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen));
let h1 = ST.get () in
Poly.reveal_ctx_inv ctx h0 h1;
update_sub_f h1
block
8ul
8ul
(fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen));
let h2 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen));
LSeq.lemma_concat2 8
(BSeq.uint_to_bytes_le #U64 (to_u64 aadlen))
8
(BSeq.uint_to_bytes_le #U64 (to_u64 mlen))
(as_seq h2 block);
Poly.reveal_ctx_inv ctx h1 h2;
Poly.poly1305_update1 ctx block | {
"checked_file": "Hacl.Impl.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20Poly1305.fst"
} | [] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Hacl.Impl.Poly1305.poly1305_ctx",
"Hacl.Impl.Poly1305.poly1305_update1",
"Prims.unit",
"Hacl.Impl.Poly1305.reveal_ctx_inv",
"Lib.Sequence.lemma_concat2",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.ByteSequence.uint_to_bytes_le",
"Lib.IntTypes.U64",
"Lib.IntTypes.to_u64",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.Sequence.eq_intro",
"Lib.Sequence.sub",
"Lib.IntTypes.v",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.update_sub_f",
"Lib.Sequence.lseq",
"Lib.ByteBuffer.uint_to_bytes_le",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub",
"Prims.op_disEquality",
"FStar.UInt32.t",
"Hacl.Impl.Chacha20Poly1305.PolyCore.poly1305_padded",
"Prims.bool",
"Hacl.Impl.Poly1305.poly1305_init"
] | [] | module Hacl.Impl.Chacha20Poly1305
open FStar.HyperStack.All
open FStar.HyperStack
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Hacl.Impl.Chacha20Poly1305.PolyCore
open Hacl.Impl.Poly1305.Fields
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Spec = Spec.Chacha20Poly1305
module SpecPoly = Spec.Poly1305
module Poly = Hacl.Impl.Poly1305
#reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options"
val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx))
[@Meta.Attribute.inline_] | false | false | Hacl.Impl.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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": 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": 150,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_do_:
#w:field_spec
-> k:lbuffer uint8 32ul // key
-> aadlen:size_t
-> aad:lbuffer uint8 aadlen // authenticated additional data
-> mlen:size_t
-> m:lbuffer uint8 mlen // plaintext
-> ctx:Poly.poly1305_ctx w
-> block:lbuffer uint8 16ul ->
Stack unit
(requires fun h ->
live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\
disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\
disjoint block k /\ disjoint block aad /\ disjoint block m)
(ensures fun h0 _ h1 ->
modifies (loc ctx |+| loc block) h0 h1 /\
(let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in
let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in
let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in
let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad)))
(BSeq.uint_to_bytes_le #U64 (u64 (length m))) in
let acc = SpecPoly.poly1305_update1 r 16 block_s acc in
Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\
Poly.state_inv_t h1 ctx)) | [] | Hacl.Impl.Chacha20Poly1305.poly1305_do_ | {
"file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
aadlen: Lib.IntTypes.size_t ->
aad: Lib.Buffer.lbuffer Lib.IntTypes.uint8 aadlen ->
mlen: Lib.IntTypes.size_t ->
m: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
ctx: Hacl.Impl.Poly1305.poly1305_ctx w ->
block: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 33,
"end_line": 73,
"start_col": 2,
"start_line": 50
} |
Prims.Tot | val size_tag:size_nat | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 size_tag : size_nat = size_block | val size_tag:size_nat
let size_tag:size_nat = | false | null | false | size_block | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Chacha20Poly1305.size_block"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *)
let size_nonce : size_nat = 12 (* in bytes *) | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_tag:size_nat | [] | Spec.Chacha20Poly1305.size_tag | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat{n <= Prims.pow2 32 - 1} | {
"end_col": 36,
"end_line": 18,
"start_col": 26,
"start_line": 18
} |
Prims.Tot | val size_block:size_nat | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 size_block : size_nat = Poly.size_block | val size_block:size_nat
let size_block:size_nat = | false | null | false | Poly.size_block | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.size_block"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *) | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_block:size_nat | [] | Spec.Chacha20Poly1305.size_block | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat{n <= Prims.pow2 32 - 1} | {
"end_col": 43,
"end_line": 17,
"start_col": 28,
"start_line": 17
} |
Prims.Tot | val size_key:size_nat | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 size_key : size_nat = 32 | val size_key:size_nat
let size_key:size_nat = | false | null | false | 32 | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_key:size_nat | [] | Spec.Chacha20Poly1305.size_key | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat{n <= Prims.pow2 32 - 1} | {
"end_col": 30,
"end_line": 15,
"start_col": 28,
"start_line": 15
} |
Prims.Tot | val size_nonce:size_nat | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 size_nonce : size_nat = 12 | val size_nonce:size_nat
let size_nonce:size_nat = | false | null | false | 12 | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_nonce:size_nat | [] | Spec.Chacha20Poly1305.size_nonce | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat{n <= Prims.pow2 32 - 1} | {
"end_col": 30,
"end_line": 16,
"start_col": 28,
"start_line": 16
} |
Prims.Tot | val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 poly1305_padded r_elem text acc =
let len = length text in
let n = len / Poly.size_block in
let r = len % Poly.size_block in
let blocks = Seq.slice text 0 (n * Poly.size_block) in
let rem = Seq.slice text (n * Poly.size_block) len in
let acc = Poly.poly1305_update blocks acc r_elem in
let tmp = create Poly.size_block (u8 0) in
let tmp = update_sub tmp 0 r rem in
// Only run the padded block if the initial text needed padding
let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in
acc | val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem
let poly1305_padded r_elem text acc = | false | null | false | let len = length text in
let n = len / Poly.size_block in
let r = len % Poly.size_block in
let blocks = Seq.slice text 0 (n * Poly.size_block) in
let rem = Seq.slice text (n * Poly.size_block) len in
let acc = Poly.poly1305_update blocks acc r_elem in
let tmp = create Poly.size_block (u8 0) in
let tmp = update_sub tmp 0 r rem in
let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in
acc | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.felem",
"Lib.ByteSequence.bytes",
"Prims.op_GreaterThan",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block",
"Prims.bool",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.l_and",
"Prims.eq2",
"Lib.Sequence.sub",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_or",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index",
"Lib.Sequence.update_sub",
"Lib.IntTypes.uint_t",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.create",
"Lib.IntTypes.mk_int",
"Prims.l_imp",
"Lib.Sequence.create",
"Lib.IntTypes.u8",
"Spec.Poly1305.poly1305_update",
"FStar.Seq.Base.slice",
"FStar.Mul.op_Star",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Division",
"Lib.Sequence.length"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *)
let size_nonce : size_nat = 12 (* in bytes *)
let size_block : size_nat = Poly.size_block
let size_tag : size_nat = size_block
/// Types
type key = lbytes size_key
type nonce = lbytes size_nonce
type tag = lbytes size_tag
/// Specification
val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem -> | false | true | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem | [] | Spec.Chacha20Poly1305.poly1305_padded | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r_elem: Spec.Poly1305.felem -> text: Lib.ByteSequence.bytes -> acc: Spec.Poly1305.felem
-> Spec.Poly1305.felem | {
"end_col": 5,
"end_line": 45,
"start_col": 37,
"start_line": 33
} |
Prims.Tot | val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} ->
Tot Poly.tag | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 poly1305_do k m aad =
let acc, r = Poly.poly1305_init k in
let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in
let acc = if (length m <> 0) then poly1305_padded r m acc else acc in
let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in
let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in
let block = aad_len8 @| ciphertext_len8 in
let acc = Poly.poly1305_update1 r 16 block acc in
Poly.poly1305_finish k acc | val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} ->
Tot Poly.tag
let poly1305_do k m aad = | false | null | false | let acc, r = Poly.poly1305_init k in
let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in
let acc = if (length m <> 0) then poly1305_padded r m acc else acc in
let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in
let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in
let block = aad_len8 @| ciphertext_len8 in
let acc = Poly.poly1305_update1 r 16 block acc in
Poly.poly1305_finish k acc | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.key",
"Lib.ByteSequence.bytes",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U64",
"Spec.Poly1305.felem",
"Spec.Poly1305.poly1305_finish",
"Spec.Poly1305.poly1305_update1",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Prims.op_Addition",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.append",
"Lib.Sequence.op_At_Bar",
"Lib.IntTypes.numbytes",
"Lib.ByteSequence.uint_to_bytes_le",
"Lib.IntTypes.u64",
"Prims.op_disEquality",
"Prims.int",
"Spec.Chacha20Poly1305.poly1305_padded",
"Prims.bool",
"Spec.Poly1305.tag",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.poly1305_init"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *)
let size_nonce : size_nat = 12 (* in bytes *)
let size_block : size_nat = Poly.size_block
let size_tag : size_nat = size_block
/// Types
type key = lbytes size_key
type nonce = lbytes size_nonce
type tag = lbytes size_tag
/// Specification
val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem
let poly1305_padded r_elem text acc =
let len = length text in
let n = len / Poly.size_block in
let r = len % Poly.size_block in
let blocks = Seq.slice text 0 (n * Poly.size_block) in
let rem = Seq.slice text (n * Poly.size_block) len in
let acc = Poly.poly1305_update blocks acc r_elem in
let tmp = create Poly.size_block (u8 0) in
let tmp = update_sub tmp 0 r rem in
// Only run the padded block if the initial text needed padding
let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in
acc
val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} -> | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} ->
Tot Poly.tag | [] | Spec.Chacha20Poly1305.poly1305_do | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Spec.Poly1305.key ->
m: Lib.ByteSequence.bytes{Lib.Sequence.length m <= Lib.IntTypes.maxint Lib.IntTypes.U64} ->
aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64}
-> Spec.Poly1305.tag | {
"end_col": 28,
"end_line": 60,
"start_col": 25,
"start_line": 52
} |
Prims.Tot | val aead_encrypt:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64} ->
Tot (res:bytes{length res == length m + Poly.size_block}) | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 aead_encrypt k n m aad =
let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in
let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in
let poly_k = sub key0 0 32 in
let mac = poly1305_do poly_k cipher aad in
Seq.append cipher mac | val aead_encrypt:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64} ->
Tot (res:bytes{length res == length m + Poly.size_block})
let aead_encrypt k n m aad = | false | null | false | let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in
let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in
let poly_k = sub key0 0 32 in
let mac = poly1305_do poly_k cipher aad in
Seq.append cipher mac | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Chacha20Poly1305.key",
"Spec.Chacha20Poly1305.nonce",
"Lib.ByteSequence.bytes",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U64",
"FStar.Seq.Base.append",
"Spec.Poly1305.tag",
"Spec.Chacha20Poly1305.poly1305_do",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Prims.l_Forall",
"Prims.nat",
"Prims.op_LessThan",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.Sequence.sub",
"Spec.Chacha20.chacha20_encrypt_bytes",
"Lib.Sequence.create",
"Lib.IntTypes.u8",
"Lib.Sequence.seq",
"Prims.int",
"Spec.Poly1305.size_block"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *)
let size_nonce : size_nat = 12 (* in bytes *)
let size_block : size_nat = Poly.size_block
let size_tag : size_nat = size_block
/// Types
type key = lbytes size_key
type nonce = lbytes size_nonce
type tag = lbytes size_tag
/// Specification
val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem
let poly1305_padded r_elem text acc =
let len = length text in
let n = len / Poly.size_block in
let r = len % Poly.size_block in
let blocks = Seq.slice text 0 (n * Poly.size_block) in
let rem = Seq.slice text (n * Poly.size_block) len in
let acc = Poly.poly1305_update blocks acc r_elem in
let tmp = create Poly.size_block (u8 0) in
let tmp = update_sub tmp 0 r rem in
// Only run the padded block if the initial text needed padding
let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in
acc
val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} ->
Tot Poly.tag
let poly1305_do k m aad =
let acc, r = Poly.poly1305_init k in
let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in
let acc = if (length m <> 0) then poly1305_padded r m acc else acc in
let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in
let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in
let block = aad_len8 @| ciphertext_len8 in
let acc = Poly.poly1305_update1 r 16 block acc in
Poly.poly1305_finish k acc
val aead_encrypt:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64} -> | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_encrypt:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64} ->
Tot (res:bytes{length res == length m + Poly.size_block}) | [] | Spec.Chacha20Poly1305.aead_encrypt | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Spec.Chacha20Poly1305.key ->
n: Spec.Chacha20Poly1305.nonce ->
m: Lib.ByteSequence.bytes{Lib.Sequence.length m <= Lib.IntTypes.max_size_t} ->
aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64}
-> res:
Lib.ByteSequence.bytes
{Lib.Sequence.length res == Lib.Sequence.length m + Spec.Poly1305.size_block} | {
"end_col": 23,
"end_line": 73,
"start_col": 28,
"start_line": 68
} |
Prims.Tot | val aead_decrypt:
k:key
-> n:nonce
-> c:bytes{length c <= max_size_t}
-> mac:tag
-> aad:bytes{length aad <= maxint U64} ->
Tot (option (lbytes (length c))) | [
{
"abbrev": true,
"full_module": "Spec.Poly1305",
"short_module": "Poly"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 aead_decrypt k n cipher mac aad =
let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in
let poly_k = sub key0 0 32 in
let computed_mac = poly1305_do poly_k cipher aad in
if lbytes_eq computed_mac mac then
let plain = Spec.Chacha20.chacha20_encrypt_bytes k n 1 cipher in
Some plain
else None | val aead_decrypt:
k:key
-> n:nonce
-> c:bytes{length c <= max_size_t}
-> mac:tag
-> aad:bytes{length aad <= maxint U64} ->
Tot (option (lbytes (length c)))
let aead_decrypt k n cipher mac aad = | false | null | false | let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in
let poly_k = sub key0 0 32 in
let computed_mac = poly1305_do poly_k cipher aad in
if lbytes_eq computed_mac mac
then
let plain = Spec.Chacha20.chacha20_encrypt_bytes k n 1 cipher in
Some plain
else None | {
"checked_file": "Spec.Chacha20Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Chacha20Poly1305.fst"
} | [
"total"
] | [
"Spec.Chacha20Poly1305.key",
"Spec.Chacha20Poly1305.nonce",
"Lib.ByteSequence.bytes",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.max_size_t",
"Spec.Chacha20Poly1305.tag",
"Lib.IntTypes.maxint",
"Lib.IntTypes.U64",
"Lib.ByteSequence.lbytes_eq",
"Spec.Poly1305.size_block",
"FStar.Pervasives.Native.Some",
"Lib.ByteSequence.lbytes",
"Lib.Sequence.seq",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.nat",
"Spec.Chacha20.chacha20_encrypt_bytes",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"Spec.Poly1305.tag",
"Spec.Chacha20Poly1305.poly1305_do",
"Lib.Sequence.lseq",
"Prims.l_and",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Prims.l_Forall",
"Prims.op_LessThan",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.Sequence.sub",
"Lib.Sequence.create",
"Lib.IntTypes.u8"
] | [] | module Spec.Chacha20Poly1305
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.ByteSequence
module Poly = Spec.Poly1305
(* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *)
#set-options "--max_fuel 0 --z3rlimit 30"
/// Constants
let size_key : size_nat = 32 (* in bytes *)
let size_nonce : size_nat = 12 (* in bytes *)
let size_block : size_nat = Poly.size_block
let size_tag : size_nat = size_block
/// Types
type key = lbytes size_key
type nonce = lbytes size_nonce
type tag = lbytes size_tag
/// Specification
val poly1305_padded:
r_elem:Poly.felem
-> text:bytes
-> acc:Poly.felem ->
Tot Poly.felem
let poly1305_padded r_elem text acc =
let len = length text in
let n = len / Poly.size_block in
let r = len % Poly.size_block in
let blocks = Seq.slice text 0 (n * Poly.size_block) in
let rem = Seq.slice text (n * Poly.size_block) len in
let acc = Poly.poly1305_update blocks acc r_elem in
let tmp = create Poly.size_block (u8 0) in
let tmp = update_sub tmp 0 r rem in
// Only run the padded block if the initial text needed padding
let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in
acc
val poly1305_do:
k:Poly.key
-> m:bytes{length m <= maxint U64}
-> aad:bytes{length aad <= maxint U64} ->
Tot Poly.tag
let poly1305_do k m aad =
let acc, r = Poly.poly1305_init k in
let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in
let acc = if (length m <> 0) then poly1305_padded r m acc else acc in
let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in
let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in
let block = aad_len8 @| ciphertext_len8 in
let acc = Poly.poly1305_update1 r 16 block acc in
Poly.poly1305_finish k acc
val aead_encrypt:
k:key
-> n:nonce
-> m:bytes{length m <= max_size_t}
-> aad:bytes{length aad <= maxint U64} ->
Tot (res:bytes{length res == length m + Poly.size_block})
let aead_encrypt k n m aad =
let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in
let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in
let poly_k = sub key0 0 32 in
let mac = poly1305_do poly_k cipher aad in
Seq.append cipher mac
val aead_decrypt:
k:key
-> n:nonce
-> c:bytes{length c <= max_size_t}
-> mac:tag
-> aad:bytes{length aad <= maxint U64} -> | false | false | Spec.Chacha20Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_decrypt:
k:key
-> n:nonce
-> c:bytes{length c <= max_size_t}
-> mac:tag
-> aad:bytes{length aad <= maxint U64} ->
Tot (option (lbytes (length c))) | [] | Spec.Chacha20Poly1305.aead_decrypt | {
"file_name": "specs/Spec.Chacha20Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Spec.Chacha20Poly1305.key ->
n: Spec.Chacha20Poly1305.nonce ->
c: Lib.ByteSequence.bytes{Lib.Sequence.length c <= Lib.IntTypes.max_size_t} ->
mac: Spec.Chacha20Poly1305.tag ->
aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64}
-> FStar.Pervasives.Native.option (Lib.ByteSequence.lbytes (Lib.Sequence.length c)) | {
"end_col": 11,
"end_line": 89,
"start_col": 37,
"start_line": 82
} |
FStar.Pervasives.Lemma | val lemma_fmul_simplify
(r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3
a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) : Lemma
(requires (
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4) /\
d10 = d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48))
(ensures
(r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208) % S.prime =
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_fmul_simplify r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7;
lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8;
lemma_fmul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 | val lemma_fmul_simplify
(r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3
a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) : Lemma
(requires (
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4) /\
d10 = d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48))
(ensures
(r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208) % S.prime =
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime)
let lemma_fmul_simplify r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 = | false | null | true | let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7;
lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8;
lemma_fmul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_fmul_ab",
"Prims.unit",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r43210_mod_prime",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r43210",
"Prims.int",
"FStar.Mul.op_Star",
"Prims.op_Addition"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
}
val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r))
let simplify_c3 d4 r sum5 =
let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc (==) { //simplify c3
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4); Math.Lemmas.pow2_plus 48 4 }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_add_left (d4 / pow2 48) ((k - d4 / pow2 52) * pow2 4) (r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * pow2 4 * (r / pow2 4);
(==) { Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4); Math.Lemmas.div_exact_r r (pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
}
val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8 =
let tmp2 = sum3 + r * (sum8 % pow2 64) in
let tmp1 = d4 / pow2 52 + sum5 in
let tmp0 = sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r in
let d4mod = (d4 % pow2 48) * pow2 208 + (d4 / pow2 48) * 0x1000003D1 in
calc (==) {
c3 + (d4 % pow2 48) * pow2 208 + (sum1 + r * d8) * pow2 52;
(==) { simplify_c3 d4 r sum5; assert_norm (0x1000003D10 / pow2 4 = 0x1000003D1) }
d4mod + tmp0 + (sum1 + r * d8) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * d8) (pow2 52) }
d4mod + sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { Math.Lemmas.distributivity_sub_left (tmp1 % pow2 52) (d4 / pow2 52) r }
d4mod + sum0 + (tmp1 % pow2 52) * r - d4 / pow2 52 * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r tmp1 sum6 (pow2 52) }
d4mod + sum0 + r * (d4 / pow2 52 + sum5) - d4 / pow2 52 * r + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_right r (d4 / pow2 52) sum5 }
d4mod + sum0 + r * sum5 + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
d4mod + sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52;
};
calc (==) { //t3 * pow2 156 + d4 * pow2 208;
(tmp2 % pow2 52) * pow2 156 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 208;
(==) { ML.lemma_distr_pow (tmp2 % pow2 52) (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) 52 156 }
(tmp2 % pow2 52 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_eucl_mul_add 1 tmp2 (sum4 + r * pow2 12 * (sum8 / pow2 64)) (pow2 52) }
(tmp2 + (sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_swap_mul3 r (pow2 12) (sum8 / pow2 64) }
(tmp2 + (sum4 + r * (sum8 / pow2 64) * pow2 12) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow sum4 (r * (sum8 / pow2 64)) 12 52 }
(sum3 + r * (sum8 % pow2 64) + sum4 * pow2 52 + r * (sum8 / pow2 64) * pow2 64) * pow2 156;
(==) { ML.lemma_distr_eucl_mul r sum8 (pow2 64) }
(sum3 + r * sum8 + sum4 * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow (sum3 + r * sum8) sum4 52 156 }
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208;
};
LD.as_nat_mod_prime (sum0 + r * sum5) (sum1 + r * sum6) (sum2 + r * sum7) t3 d4
val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156))
let lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
calc (==) {
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;
(==) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }
a0 * b_sum + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }
sum0 + sum1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ a1 * b4 * pow2 260
+ a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260
+ a2 * b4 * pow2 312
+ a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + a3 * b4 * pow2 364 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + sum7 * pow2 364 + sum8 * pow2 416;
(==) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);
}
val lemma_fmul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_fmul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let a_sum = a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
let tmp0 = sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 in
let tmp1 = sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156 in
calc (==) {
a_sum * b_sum % S.prime;
(==) { lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 }
(tmp0 + pow2 260 * tmp1) % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4; Math.Lemmas.paren_mul_right (pow2 256) (pow2 4) tmp1 }
(tmp0 + pow2 256 * (pow2 4 * tmp1)) % S.prime;
(==) { LD.lemma_a_plus_b_mul_pow256 tmp0 (pow2 4 * tmp1) }
(tmp0 + 0x1000003D1 * (pow2 4 * tmp1)) % S.prime;
(==) { Math.Lemmas.paren_mul_right 0x1000003D1 (pow2 4) tmp1; assert_norm (0x1000003D1 * pow2 4 = r) }
(tmp0 + r * tmp1) % S.prime;
(==) { ML.lemma_distr5_pow52 r sum5 sum6 sum7 sum8 0 }
(sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ r * sum5 + r * sum6 * pow2 52 + r * sum7 * pow2 104 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ r * sum7 * pow2 104 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ sum3 * pow2 156 + sum4 * pow2 208 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum3 (r * sum8) (pow2 156) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime;
}
val lemma_fmul_simplify
(r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3
a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) : Lemma
(requires (
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4) /\
d10 = d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48))
(ensures
(r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208) % S.prime =
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_fmul_simplify
(r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3
a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) : Lemma
(requires (
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4) /\
d10 = d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48))
(ensures
(r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208) % S.prime =
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_fmul_simplify | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r0: Prims.nat ->
r1: Prims.nat ->
r2: Prims.nat ->
r3: Prims.nat ->
r4: Prims.nat ->
c3: Prims.nat ->
c6: Prims.nat ->
c9: Prims.nat ->
c11: Prims.nat ->
d4: Prims.nat ->
d8: Prims.nat ->
d10: Prims.nat ->
d11: Prims.nat ->
t3: Prims.nat ->
a0: Prims.nat ->
a1: Prims.nat ->
a2: Prims.nat ->
a3: Prims.nat ->
a4: Prims.nat ->
b0: Prims.nat ->
b1: Prims.nat ->
b2: Prims.nat ->
b3: Prims.nat ->
b4: Prims.nat
-> FStar.Pervasives.Lemma
(requires
(let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
d4 =
(sum3 + r * (sum8 % Prims.pow2 64)) / Prims.pow2 52 + sum4 +
(r * Prims.pow2 12) * (sum8 / Prims.pow2 64) /\
t3 = (sum3 + r * (sum8 % Prims.pow2 64)) % Prims.pow2 52 /\
d8 = (d4 / Prims.pow2 52 + sum5) / Prims.pow2 52 + sum6 /\
c3 =
sum0 +
(d4 % Prims.pow2 52 / Prims.pow2 48 +
((d4 / Prims.pow2 52 + sum5) % Prims.pow2 52) * Prims.pow2 4) *
(r / Prims.pow2 4) /\ d10 = d8 / Prims.pow2 52 + sum7 /\ r0 = c3 % Prims.pow2 52 /\
c6 = c3 / Prims.pow2 52 + sum1 + (d8 % Prims.pow2 52) * r /\ d11 = d10 / Prims.pow2 64 /\
r1 = c6 % Prims.pow2 52 /\ c9 = c6 / Prims.pow2 52 + sum2 + r * (d10 % Prims.pow2 64) /\
r2 = c9 % Prims.pow2 52 /\ c11 = c9 / Prims.pow2 52 + (r * Prims.pow2 12) * d11 + t3 /\
r3 = c11 % Prims.pow2 52 /\ r4 = c11 / Prims.pow2 52 + d4 % Prims.pow2 52 % Prims.pow2 48)
)
(ensures
(r0 + r1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
r2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
r3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
r4 * Hacl.Spec.K256.Field52.Definitions.pow208) %
Spec.K256.PointOps.prime =
(a0 + a1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
a2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
a3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
a4 * Hacl.Spec.K256.Field52.Definitions.pow208) *
(b0 + b1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
b2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
b3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
b4 * Hacl.Spec.K256.Field52.Definitions.pow208) %
Spec.K256.PointOps.prime) | {
"end_col": 45,
"end_line": 399,
"start_col": 100,
"start_line": 385
} |
FStar.Pervasives.Lemma | val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
} | val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r = | false | null | true | let k = d4 % pow2 48 in
calc ( == ) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
( == ) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
( == ) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + (r * pow2 12) * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
( == ) { ML.lemma_distr_eucl c9 ((r * pow2 12) * d11 + t3 + k * pow2 52) }
c9 + ((r * pow2 12) * d11 + t3 + k * pow2 52) * pow2 52;
( == ) { ML.lemma_distr_pow ((r * pow2 12) * d11 + t3) k 52 52 }
c9 + ((r * pow2 12) * d11 + t3) * pow2 52 + k * pow2 104;
( == ) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + ((r * d11) * pow2 12 + t3) * pow2 52 + k * pow2 104;
( == ) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + (r * d11) * pow2 64 + t3 * pow2 52 + k * pow2 104;
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Division",
"Prims.op_Modulus",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1",
"Prims.squash",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl",
"Hacl.Spec.K256.MathLemmas.lemma_distr_pow",
"Hacl.Spec.K256.MathLemmas.lemma_swap_mul3"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r432 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r2: Prims.nat ->
r3: Prims.nat ->
r4: Prims.nat ->
c9: Prims.nat ->
c11: Prims.nat ->
d4: Prims.nat ->
d11: Prims.nat ->
t3: Prims.nat ->
r: Prims.nat
-> FStar.Pervasives.Lemma
(requires
r2 = c9 % Prims.pow2 52 /\ c11 = c9 / Prims.pow2 52 + (r * Prims.pow2 12) * d11 + t3 /\
r3 = c11 % Prims.pow2 52 /\ r4 = c11 / Prims.pow2 52 + d4 % Prims.pow2 52 % Prims.pow2 48)
(ensures
(r4 * Prims.pow2 52 + r3) * Prims.pow2 52 + r2 =
c9 + (r * d11) * Prims.pow2 64 + t3 * Prims.pow2 52 + (d4 % Prims.pow2 48) * Prims.pow2 104) | {
"end_col": 5,
"end_line": 40,
"start_col": 48,
"start_line": 24
} |
FStar.Pervasives.Lemma | val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 simplify_c3 d4 r sum5 =
let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc (==) { //simplify c3
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4); Math.Lemmas.pow2_plus 48 4 }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_add_left (d4 / pow2 48) ((k - d4 / pow2 52) * pow2 4) (r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * pow2 4 * (r / pow2 4);
(==) { Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4); Math.Lemmas.div_exact_r r (pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
} | val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r))
let simplify_c3 d4 r sum5 = | false | null | true | let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc ( == ) {
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
( == ) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
( == ) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
( == ) { (Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4);
Math.Lemmas.pow2_plus 48 4) }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
( == ) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
( == ) { Math.Lemmas.distributivity_add_left (d4 / pow2 48)
((k - d4 / pow2 52) * pow2 4)
(r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + ((k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
( == ) { (Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4);
Math.Lemmas.div_exact_r r (pow2 4)) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"FStar.Mul.op_Star",
"Prims.op_Addition",
"Prims.op_Division",
"Prims.op_Modulus",
"Prims.pow2",
"Prims.op_Subtraction",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.pow2_modulo_division_lemma_1",
"Prims.squash",
"FStar.Math.Lemmas.euclidean_division_definition",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Math.Lemmas.division_multiplication_lemma",
"FStar.Math.Lemmas.distributivity_sub_left",
"FStar.Math.Lemmas.distributivity_add_left",
"FStar.Math.Lemmas.div_exact_r",
"FStar.Math.Lemmas.paren_mul_right"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
}
val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r)) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r)) | [] | Hacl.Spec.K256.Field52.Lemmas4.simplify_c3 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | d4: Prims.nat -> r: Prims.nat -> sum5: Prims.nat
-> FStar.Pervasives.Lemma (requires r % Prims.pow2 4 = 0)
(ensures
(let k = (d4 / Prims.pow2 52 + sum5) % Prims.pow2 52 in
(d4 % Prims.pow2 52 / Prims.pow2 48 + k * Prims.pow2 4) * (r / Prims.pow2 4) ==
(d4 / Prims.pow2 48) * (r / Prims.pow2 4) + (k - d4 / Prims.pow2 52) * r)) | {
"end_col": 3,
"end_line": 142,
"start_col": 27,
"start_line": 125
} |
FStar.Pervasives.Lemma | val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
} | val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 = | false | null | true | let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc ( == ) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
( == ) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + (r * d11) * pow2 64 + tmp1) * pow2 52 + r1;
( == ) { () }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + (r * d11) * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
( == ) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
( == ) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
( == ) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
( == ) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + (r * d10) * pow2 52 + tmp1 * pow2 52;
( == ) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + (r * d10) * pow2 52 + t3 * pow2 104 + k * pow2 156;
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Division",
"Prims.op_Modulus",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r432",
"Prims.squash",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl",
"FStar.Math.Lemmas.distributivity_add_left",
"Hacl.Spec.K256.MathLemmas.lemma_distr_pow_pow"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r4321 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r1: Prims.nat ->
r2: Prims.nat ->
r3: Prims.nat ->
r4: Prims.nat ->
c6: Prims.nat ->
c9: Prims.nat ->
c11: Prims.nat ->
d4: Prims.nat ->
d10: Prims.nat ->
d11: Prims.nat ->
t3: Prims.nat ->
r: Prims.nat ->
sum2: Prims.nat
-> FStar.Pervasives.Lemma
(requires
d11 = d10 / Prims.pow2 64 /\ r1 = c6 % Prims.pow2 52 /\
c9 = c6 / Prims.pow2 52 + sum2 + r * (d10 % Prims.pow2 64) /\ r2 = c9 % Prims.pow2 52 /\
c11 = c9 / Prims.pow2 52 + (r * Prims.pow2 12) * d11 + t3 /\ r3 = c11 % Prims.pow2 52 /\
r4 = c11 / Prims.pow2 52 + d4 % Prims.pow2 52 % Prims.pow2 48)
(ensures
((r4 * Prims.pow2 52 + r3) * Prims.pow2 52 + r2) * Prims.pow2 52 + r1 =
c6 + sum2 * Prims.pow2 52 + (r * d10) * Prims.pow2 52 + t3 * Prims.pow2 104 +
(d4 % Prims.pow2 48) * Prims.pow2 156) | {
"end_col": 5,
"end_line": 73,
"start_col": 64,
"start_line": 53
} |
FStar.Pervasives.Lemma | val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
} | val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 = | false | null | true | let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc ( == ) {
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
( == ) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
( == ) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc ( == ) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
( == ) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
( == ) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + (d8 % pow2 52) * r + (r * (d8 / pow2 52 + sum7)) * pow2 52 + tmp1) *
pow2 52 +
c3 % pow2 52;
( == ) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + (r * sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
( == ) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + (r * sum7) * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + (r * sum7) * pow2 52 + tmp1) * pow2 52;
( == ) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + (r * sum7) * pow2 104;
( == ) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 +
(r * sum7) * pow2 104;
( == ) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Addition",
"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.pow2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Prims.op_Division",
"Prims.op_Modulus",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.K256.MathLemmas.lemma_as_nat_horner",
"Prims.squash",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r4321",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul_add",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl",
"Hacl.Spec.K256.MathLemmas.lemma_distr_pow",
"FStar.Math.Lemmas.distributivity_add_left",
"Hacl.Spec.K256.MathLemmas.lemma_distr_pow_pow"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r43210 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r0: Prims.nat ->
r1: Prims.nat ->
r2: Prims.nat ->
r3: Prims.nat ->
r4: Prims.nat ->
c3: Prims.nat ->
c6: Prims.nat ->
c9: Prims.nat ->
c11: Prims.nat ->
d4: Prims.nat ->
d8: Prims.nat ->
d10: Prims.nat ->
d11: Prims.nat ->
t3: Prims.nat ->
r: Prims.nat ->
sum1: Prims.nat ->
sum2: Prims.nat ->
sum7: Prims.nat
-> FStar.Pervasives.Lemma
(requires
d10 == d8 / Prims.pow2 52 + sum7 /\ r0 = c3 % Prims.pow2 52 /\
c6 = c3 / Prims.pow2 52 + sum1 + (d8 % Prims.pow2 52) * r /\ d11 = d10 / Prims.pow2 64 /\
r1 = c6 % Prims.pow2 52 /\ c9 = c6 / Prims.pow2 52 + sum2 + r * (d10 % Prims.pow2 64) /\
r2 = c9 % Prims.pow2 52 /\ c11 = c9 / Prims.pow2 52 + (r * Prims.pow2 12) * d11 + t3 /\
r3 = c11 % Prims.pow2 52 /\ r4 = c11 / Prims.pow2 52 + d4 % Prims.pow2 52 % Prims.pow2 48)
(ensures
r0 + r1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
r2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
r3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
r4 * Hacl.Spec.K256.Field52.Definitions.pow208 =
c3 + (sum1 + r * d8) * Prims.pow2 52 + (sum2 + r * sum7) * Prims.pow2 104 +
t3 * Prims.pow2 156 +
(d4 % Prims.pow2 48) * Prims.pow2 208) | {
"end_col": 5,
"end_line": 116,
"start_col": 84,
"start_line": 88
} |
FStar.Pervasives.Lemma | val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8 =
let tmp2 = sum3 + r * (sum8 % pow2 64) in
let tmp1 = d4 / pow2 52 + sum5 in
let tmp0 = sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r in
let d4mod = (d4 % pow2 48) * pow2 208 + (d4 / pow2 48) * 0x1000003D1 in
calc (==) {
c3 + (d4 % pow2 48) * pow2 208 + (sum1 + r * d8) * pow2 52;
(==) { simplify_c3 d4 r sum5; assert_norm (0x1000003D10 / pow2 4 = 0x1000003D1) }
d4mod + tmp0 + (sum1 + r * d8) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * d8) (pow2 52) }
d4mod + sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { Math.Lemmas.distributivity_sub_left (tmp1 % pow2 52) (d4 / pow2 52) r }
d4mod + sum0 + (tmp1 % pow2 52) * r - d4 / pow2 52 * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r tmp1 sum6 (pow2 52) }
d4mod + sum0 + r * (d4 / pow2 52 + sum5) - d4 / pow2 52 * r + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_right r (d4 / pow2 52) sum5 }
d4mod + sum0 + r * sum5 + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
d4mod + sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52;
};
calc (==) { //t3 * pow2 156 + d4 * pow2 208;
(tmp2 % pow2 52) * pow2 156 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 208;
(==) { ML.lemma_distr_pow (tmp2 % pow2 52) (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) 52 156 }
(tmp2 % pow2 52 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_eucl_mul_add 1 tmp2 (sum4 + r * pow2 12 * (sum8 / pow2 64)) (pow2 52) }
(tmp2 + (sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_swap_mul3 r (pow2 12) (sum8 / pow2 64) }
(tmp2 + (sum4 + r * (sum8 / pow2 64) * pow2 12) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow sum4 (r * (sum8 / pow2 64)) 12 52 }
(sum3 + r * (sum8 % pow2 64) + sum4 * pow2 52 + r * (sum8 / pow2 64) * pow2 64) * pow2 156;
(==) { ML.lemma_distr_eucl_mul r sum8 (pow2 64) }
(sum3 + r * sum8 + sum4 * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow (sum3 + r * sum8) sum4 52 156 }
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208;
};
LD.as_nat_mod_prime (sum0 + r * sum5) (sum1 + r * sum6) (sum2 + r * sum7) t3 d4 | val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8 = | false | null | true | let tmp2 = sum3 + r * (sum8 % pow2 64) in
let tmp1 = d4 / pow2 52 + sum5 in
let tmp0 = sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r in
let d4mod = (d4 % pow2 48) * pow2 208 + (d4 / pow2 48) * 0x1000003D1 in
calc ( == ) {
c3 + (d4 % pow2 48) * pow2 208 + (sum1 + r * d8) * pow2 52;
( == ) { (simplify_c3 d4 r sum5;
assert_norm (0x1000003D10 / pow2 4 = 0x1000003D1)) }
d4mod + tmp0 + (sum1 + r * d8) * pow2 52;
( == ) { Math.Lemmas.distributivity_add_left sum1 (r * d8) (pow2 52) }
d4mod + sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r + sum1 * pow2 52 +
(r * (tmp1 / pow2 52 + sum6)) * pow2 52;
( == ) { Math.Lemmas.distributivity_sub_left (tmp1 % pow2 52) (d4 / pow2 52) r }
d4mod + sum0 + (tmp1 % pow2 52) * r - (d4 / pow2 52) * r + sum1 * pow2 52 +
(r * (tmp1 / pow2 52 + sum6)) * pow2 52;
( == ) { ML.lemma_distr_eucl_mul_add r tmp1 sum6 (pow2 52) }
d4mod + sum0 + r * (d4 / pow2 52 + sum5) - (d4 / pow2 52) * r + sum1 * pow2 52 +
(r * sum6) * pow2 52;
( == ) { Math.Lemmas.distributivity_add_right r (d4 / pow2 52) sum5 }
d4mod + sum0 + r * sum5 + sum1 * pow2 52 + (r * sum6) * pow2 52;
( == ) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
d4mod + sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52;
};
calc ( == ) {
(tmp2 % pow2 52) * pow2 156 +
(tmp2 / pow2 52 + sum4 + (r * pow2 12) * (sum8 / pow2 64)) * pow2 208;
( == ) { ML.lemma_distr_pow (tmp2 % pow2 52)
(tmp2 / pow2 52 + sum4 + (r * pow2 12) * (sum8 / pow2 64))
52
156 }
(tmp2 % pow2 52 + (tmp2 / pow2 52 + sum4 + (r * pow2 12) * (sum8 / pow2 64)) * pow2 52) * pow2 156;
( == ) { ML.lemma_distr_eucl_mul_add 1 tmp2 (sum4 + (r * pow2 12) * (sum8 / pow2 64)) (pow2 52) }
(tmp2 + (sum4 + (r * pow2 12) * (sum8 / pow2 64)) * pow2 52) * pow2 156;
( == ) { ML.lemma_swap_mul3 r (pow2 12) (sum8 / pow2 64) }
(tmp2 + (sum4 + (r * (sum8 / pow2 64)) * pow2 12) * pow2 52) * pow2 156;
( == ) { ML.lemma_distr_pow sum4 (r * (sum8 / pow2 64)) 12 52 }
(sum3 + r * (sum8 % pow2 64) + sum4 * pow2 52 + (r * (sum8 / pow2 64)) * pow2 64) * pow2 156;
( == ) { ML.lemma_distr_eucl_mul r sum8 (pow2 64) }
(sum3 + r * sum8 + sum4 * pow2 52) * pow2 156;
( == ) { ML.lemma_distr_pow (sum3 + r * sum8) sum4 52 156 }
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208;
};
LD.as_nat_mod_prime (sum0 + r * sum5) (sum1 + r * sum6) (sum2 + r * sum7) t3 d4 | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.as_nat_mod_prime",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.unit",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Modulus",
"Prims.pow2",
"Prims.op_Division",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.K256.MathLemmas.lemma_distr_pow",
"Prims.squash",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul_add",
"Hacl.Spec.K256.MathLemmas.lemma_swap_mul3",
"Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul",
"Prims.op_Subtraction",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Hacl.Spec.K256.Field52.Lemmas4.simplify_c3",
"FStar.Math.Lemmas.distributivity_add_left",
"FStar.Math.Lemmas.distributivity_sub_left",
"FStar.Math.Lemmas.distributivity_add_right"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
}
val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r))
let simplify_c3 d4 r sum5 =
let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc (==) { //simplify c3
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4); Math.Lemmas.pow2_plus 48 4 }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_add_left (d4 / pow2 48) ((k - d4 / pow2 52) * pow2 4) (r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * pow2 4 * (r / pow2 4);
(==) { Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4); Math.Lemmas.div_exact_r r (pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
}
val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_nat_r43210_mod_prime | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
c3: Prims.nat ->
d4: Prims.nat ->
d8: Prims.nat ->
t3: Prims.nat ->
r: Prims.nat ->
sum0: Prims.nat ->
sum1: Prims.nat ->
sum2: Prims.nat ->
sum3: Prims.nat ->
sum4: Prims.nat ->
sum5: Prims.nat ->
sum6: Prims.nat ->
sum7: Prims.nat ->
sum8: Prims.nat
-> FStar.Pervasives.Lemma
(requires
r = 0x1000003D10 /\
d4 =
(sum3 + r * (sum8 % Prims.pow2 64)) / Prims.pow2 52 + sum4 +
(r * Prims.pow2 12) * (sum8 / Prims.pow2 64) /\
t3 = (sum3 + r * (sum8 % Prims.pow2 64)) % Prims.pow2 52 /\
d8 = (d4 / Prims.pow2 52 + sum5) / Prims.pow2 52 + sum6 /\
c3 =
sum0 +
(d4 % Prims.pow2 52 / Prims.pow2 48 +
((d4 / Prims.pow2 52 + sum5) % Prims.pow2 52) * Prims.pow2 4) *
(r / Prims.pow2 4))
(ensures
(c3 + (sum1 + r * d8) * Prims.pow2 52 + (sum2 + r * sum7) * Prims.pow2 104 +
t3 * Prims.pow2 156 +
(d4 % Prims.pow2 48) * Prims.pow2 208) %
Spec.K256.PointOps.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * Prims.pow2 52 + (sum2 + r * sum7) * Prims.pow2 104 +
(sum3 + r * sum8) * Prims.pow2 156 +
sum4 * Prims.pow2 208) %
Spec.K256.PointOps.prime) | {
"end_col": 81,
"end_line": 196,
"start_col": 91,
"start_line": 158
} |
FStar.Pervasives.Lemma | val lemma_fmul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_fmul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let a_sum = a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
let tmp0 = sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 in
let tmp1 = sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156 in
calc (==) {
a_sum * b_sum % S.prime;
(==) { lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 }
(tmp0 + pow2 260 * tmp1) % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4; Math.Lemmas.paren_mul_right (pow2 256) (pow2 4) tmp1 }
(tmp0 + pow2 256 * (pow2 4 * tmp1)) % S.prime;
(==) { LD.lemma_a_plus_b_mul_pow256 tmp0 (pow2 4 * tmp1) }
(tmp0 + 0x1000003D1 * (pow2 4 * tmp1)) % S.prime;
(==) { Math.Lemmas.paren_mul_right 0x1000003D1 (pow2 4) tmp1; assert_norm (0x1000003D1 * pow2 4 = r) }
(tmp0 + r * tmp1) % S.prime;
(==) { ML.lemma_distr5_pow52 r sum5 sum6 sum7 sum8 0 }
(sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ r * sum5 + r * sum6 * pow2 52 + r * sum7 * pow2 104 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ r * sum7 * pow2 104 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ sum3 * pow2 156 + sum4 * pow2 208 + r * sum8 * pow2 156) % S.prime;
(==) { Math.Lemmas.distributivity_add_left sum3 (r * sum8) (pow2 156) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime;
} | val lemma_fmul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_fmul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 = | false | null | true | let r = 0x1000003D10 in
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let a_sum = a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
let tmp0 = sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 in
let tmp1 = sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156 in
calc ( == ) {
a_sum * b_sum % S.prime;
( == ) { lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 }
(tmp0 + pow2 260 * tmp1) % S.prime;
( == ) { (Math.Lemmas.pow2_plus 256 4;
Math.Lemmas.paren_mul_right (pow2 256) (pow2 4) tmp1) }
(tmp0 + pow2 256 * (pow2 4 * tmp1)) % S.prime;
( == ) { LD.lemma_a_plus_b_mul_pow256 tmp0 (pow2 4 * tmp1) }
(tmp0 + 0x1000003D1 * (pow2 4 * tmp1)) % S.prime;
( == ) { (Math.Lemmas.paren_mul_right 0x1000003D1 (pow2 4) tmp1;
assert_norm (0x1000003D1 * pow2 4 = r)) }
(tmp0 + r * tmp1) % S.prime;
( == ) { ML.lemma_distr5_pow52 r sum5 sum6 sum7 sum8 0 }
(sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 + r * sum5 +
(r * sum6) * pow2 52 +
(r * sum7) * pow2 104 +
(r * sum8) * pow2 156) %
S.prime;
( == ) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 +
sum4 * pow2 208 +
(r * sum7) * pow2 104 +
(r * sum8) * pow2 156) %
S.prime;
( == ) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104 + sum3 * pow2 156 +
sum4 * pow2 208 +
(r * sum8) * pow2 156) %
S.prime;
( == ) { Math.Lemmas.distributivity_add_left sum3 (r * sum8) (pow2 156) }
(sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 +
sum4 * pow2 208) %
S.prime;
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Spec.K256.PointOps.prime",
"Prims.op_Addition",
"Prims.pow2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.K256.Field52.Lemmas4.lemma_mul_ab",
"Prims.squash",
"FStar.Math.Lemmas.paren_mul_right",
"FStar.Math.Lemmas.pow2_plus",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_a_plus_b_mul_pow256",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Hacl.Spec.K256.MathLemmas.lemma_distr5_pow52",
"FStar.Math.Lemmas.distributivity_add_left",
"Hacl.Spec.K256.Field52.Definitions.pow52",
"Hacl.Spec.K256.Field52.Definitions.pow104",
"Hacl.Spec.K256.Field52.Definitions.pow156",
"Hacl.Spec.K256.Field52.Definitions.pow208"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
}
val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r))
let simplify_c3 d4 r sum5 =
let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc (==) { //simplify c3
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4); Math.Lemmas.pow2_plus 48 4 }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_add_left (d4 / pow2 48) ((k - d4 / pow2 52) * pow2 4) (r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * pow2 4 * (r / pow2 4);
(==) { Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4); Math.Lemmas.div_exact_r r (pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
}
val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8 =
let tmp2 = sum3 + r * (sum8 % pow2 64) in
let tmp1 = d4 / pow2 52 + sum5 in
let tmp0 = sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r in
let d4mod = (d4 % pow2 48) * pow2 208 + (d4 / pow2 48) * 0x1000003D1 in
calc (==) {
c3 + (d4 % pow2 48) * pow2 208 + (sum1 + r * d8) * pow2 52;
(==) { simplify_c3 d4 r sum5; assert_norm (0x1000003D10 / pow2 4 = 0x1000003D1) }
d4mod + tmp0 + (sum1 + r * d8) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * d8) (pow2 52) }
d4mod + sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { Math.Lemmas.distributivity_sub_left (tmp1 % pow2 52) (d4 / pow2 52) r }
d4mod + sum0 + (tmp1 % pow2 52) * r - d4 / pow2 52 * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r tmp1 sum6 (pow2 52) }
d4mod + sum0 + r * (d4 / pow2 52 + sum5) - d4 / pow2 52 * r + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_right r (d4 / pow2 52) sum5 }
d4mod + sum0 + r * sum5 + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
d4mod + sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52;
};
calc (==) { //t3 * pow2 156 + d4 * pow2 208;
(tmp2 % pow2 52) * pow2 156 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 208;
(==) { ML.lemma_distr_pow (tmp2 % pow2 52) (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) 52 156 }
(tmp2 % pow2 52 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_eucl_mul_add 1 tmp2 (sum4 + r * pow2 12 * (sum8 / pow2 64)) (pow2 52) }
(tmp2 + (sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_swap_mul3 r (pow2 12) (sum8 / pow2 64) }
(tmp2 + (sum4 + r * (sum8 / pow2 64) * pow2 12) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow sum4 (r * (sum8 / pow2 64)) 12 52 }
(sum3 + r * (sum8 % pow2 64) + sum4 * pow2 52 + r * (sum8 / pow2 64) * pow2 64) * pow2 156;
(==) { ML.lemma_distr_eucl_mul r sum8 (pow2 64) }
(sum3 + r * sum8 + sum4 * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow (sum3 + r * sum8) sum4 52 156 }
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208;
};
LD.as_nat_mod_prime (sum0 + r * sum5) (sum1 + r * sum6) (sum2 + r * sum7) t3 d4
val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156))
let lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
calc (==) {
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;
(==) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }
a0 * b_sum + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }
sum0 + sum1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ a1 * b4 * pow2 260
+ a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260
+ a2 * b4 * pow2 312
+ a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + a3 * b4 * pow2 364 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + sum7 * pow2 364 + sum8 * pow2 416;
(==) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);
}
val lemma_fmul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_fmul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) % S.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104
+ (sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_fmul_ab | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a0: Prims.nat ->
a1: Prims.nat ->
a2: Prims.nat ->
a3: Prims.nat ->
a4: Prims.nat ->
b0: Prims.nat ->
b1: Prims.nat ->
b2: Prims.nat ->
b3: Prims.nat ->
b4: Prims.nat
-> FStar.Pervasives.Lemma
(ensures
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let r = 0x1000003D10 in
(a0 + a1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
a2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
a3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
a4 * Hacl.Spec.K256.Field52.Definitions.pow208) *
(b0 + b1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
b2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
b3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
b4 * Hacl.Spec.K256.Field52.Definitions.pow208) %
Spec.K256.PointOps.prime =
(sum0 + sum5 * r + (sum1 + sum6 * r) * Prims.pow2 52 + (sum2 + r * sum7) * Prims.pow2 104 +
(sum3 + r * sum8) * Prims.pow2 156 +
sum4 * Prims.pow2 208) %
Spec.K256.PointOps.prime)) | {
"end_col": 5,
"end_line": 353,
"start_col": 49,
"start_line": 314
} |
FStar.Pervasives.Lemma | val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.Field52.Definitions.Lemmas",
"short_module": "LD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"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 lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =
let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
calc (==) {
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;
(==) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }
a0 * b_sum + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * pow156 * b_sum + a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * pow208 * b_sum;
(==) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }
sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }
sum0 + sum1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + a0 * b4 * pow2 208
+ a1 * b3 * pow2 208 + a1 * b4 * pow2 260
+ a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ a1 * b4 * pow2 260
+ a2 * b3 * pow2 260 + a2 * b4 * pow2 312
+ a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260
+ a2 * b4 * pow2 312
+ a3 * b3 * pow2 312 + a3 * b4 * pow2 364
+ a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + a3 * b4 * pow2 364 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;
(==) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ sum5 * pow2 260 + sum6 * pow2 312 + sum7 * pow2 364 + sum8 * pow2 416;
(==) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208
+ pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);
} | val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156))
let lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 = | false | null | true | let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in
calc ( == ) {
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }
a0 * b_sum + (a1 * pow52) * b_sum + (a2 * pow104) * b_sum + (a3 * pow156) * b_sum +
(a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }
sum0 + (a0 * b1) * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * pow52) * b_sum +
(a2 * pow104) * b_sum +
(a3 * pow156) * b_sum +
(a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }
sum0 + (a0 * b1) * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b0) * pow2 52 +
(a1 * b1) * pow2 104 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * pow104) * b_sum +
(a3 * pow156) * b_sum +
(a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }
sum0 + (a0 * b1) * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b0) * pow2 52 +
(a1 * b1) * pow2 104 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b0) * pow2 104 +
(a2 * b1) * pow2 156 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * pow156) * b_sum +
(a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }
sum0 + (a0 * b1) * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b0) * pow2 52 +
(a1 * b1) * pow2 104 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b0) * pow2 104 +
(a2 * b1) * pow2 156 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b0) * pow2 156 +
(a3 * b1) * pow2 208 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * pow208) * b_sum;
( == ) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }
sum0 + (a0 * b1) * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b0) * pow2 52 +
(a1 * b1) * pow2 104 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b0) * pow2 104 +
(a2 * b1) * pow2 156 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b0) * pow2 156 +
(a3 * b1) * pow2 208 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b0) * pow2 208 +
(a4 * b1) * pow2 260 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }
sum0 + sum1 * pow2 52 + (a0 * b2) * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b1) * pow2 104 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b0) * pow2 104 +
(a2 * b1) * pow2 156 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b0) * pow2 156 +
(a3 * b1) * pow2 208 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b0) * pow2 208 +
(a4 * b1) * pow2 260 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + (a0 * b3) * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b2) * pow2 156 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b1) * pow2 156 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b0) * pow2 156 +
(a3 * b1) * pow2 208 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b0) * pow2 208 +
(a4 * b1) * pow2 260 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + (a0 * b4) * pow2 208 +
(a1 * b3) * pow2 208 +
(a1 * b4) * pow2 260 +
(a2 * b2) * pow2 208 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b1) * pow2 208 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b0) * pow2 208 +
(a4 * b1) * pow2 260 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 + (a1 * b4) * pow2 260 +
(a2 * b3) * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b2) * pow2 260 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b1) * pow2 260 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 + sum5 * pow2 260 +
(a2 * b4) * pow2 312 +
(a3 * b3) * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b2) * pow2 312 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 + sum5 * pow2 260 +
sum6 * pow2 312 +
(a3 * b4) * pow2 364 +
(a4 * b3) * pow2 364 +
(a4 * b4) * pow2 416;
( == ) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 + sum5 * pow2 260 +
sum6 * pow2 312 +
sum7 * pow2 364 +
sum8 * pow2 416;
( == ) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);
} | {
"checked_file": "Hacl.Spec.K256.Field52.Lemmas4.fst.checked",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"Hacl.Spec.K256.Field52.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.Field52.Lemmas4.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"FStar.Mul.op_Star",
"Prims.op_Addition",
"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.pow2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.K256.MathLemmas.lemma_distr5",
"Prims.squash",
"Hacl.Spec.K256.MathLemmas.lemma_distr5_pow52",
"Hacl.Spec.K256.MathLemmas.lemma_distr5_pow52_mul_pow",
"FStar.Math.Lemmas.distributivity_add_left"
] | [] | module Hacl.Spec.K256.Field52.Lemmas4
open FStar.Mul
open Lib.IntTypes
module S = Spec.K256
include Hacl.Spec.K256.Field52.Definitions
include Hacl.Spec.K256.Field52
module ML = Hacl.Spec.K256.MathLemmas
module LD = Hacl.Spec.K256.Field52.Definitions.Lemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_nat_r432 (r2 r3 r4 c9 c11 d4 d11 t3 r:nat) : Lemma
(requires
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
(r4 * pow2 52 + r3) * pow2 52 + r2 =
c9 + r * d11 * pow2 64 + t3 * pow2 52 + (d4 % pow2 48) * pow2 104)
let lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r =
let k = d4 % pow2 48 in
calc (==) {
(r4 * pow2 52 + r3) * pow2 52 + r2;
(==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 d4 48 52 }
((c11 / pow2 52 + k) * pow2 52 + c11 % pow2 52) * pow2 52 + r2;
(==) { ML.lemma_distr_eucl c11 k }
(c9 / pow2 52 + r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52 + c9 % pow2 52;
(==) { ML.lemma_distr_eucl c9 (r * pow2 12 * d11 + t3 + k * pow2 52) }
c9 + (r * pow2 12 * d11 + t3 + k * pow2 52) * pow2 52;
(==) { ML.lemma_distr_pow (r * pow2 12 * d11 + t3) k 52 52 }
c9 + (r * pow2 12 * d11 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_swap_mul3 r (pow2 12) d11 }
c9 + (r * d11 * pow2 12 + t3) * pow2 52 + k * pow2 104;
(==) { ML.lemma_distr_pow t3 (r * d11) 12 52 }
c9 + r * d11 * pow2 64 + t3 * pow2 52 + k * pow2 104;
}
val lemma_nat_r4321 (r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2:nat) : Lemma
(requires
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1 =
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + (d4 % pow2 48) * pow2 156)
let lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 =
let k = d4 % pow2 48 in
let tmp1 = t3 * pow2 52 + k * pow2 104 in
calc (==) {
((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1;
(==) { lemma_nat_r432 r2 r3 r4 c9 c11 d4 d11 t3 r }
(c9 + r * d11 * pow2 64 + tmp1) * pow2 52 + r1;
(==) { }
(c6 / pow2 52 + sum2 + r * (d10 % pow2 64) + r * d11 * pow2 64 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl_mul r d10 (pow2 64) }
(c6 / pow2 52 + sum2 + r * d10 + tmp1) * pow2 52 + c6 % pow2 52;
(==) { ML.lemma_distr_eucl c6 (sum2 + r * d10 + tmp1) }
c6 + (sum2 + r * d10 + tmp1) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left (sum2 + r * d10) tmp1 (pow2 52) }
c6 + (sum2 + r * d10) * pow2 52 + tmp1 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * d10) (pow2 52) }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + tmp1 * pow2 52;
(==) { ML.lemma_distr_pow_pow t3 52 k 104 52 }
c6 + sum2 * pow2 52 + r * d10 * pow2 52 + t3 * pow2 104 + k * pow2 156;
}
val lemma_nat_r43210 (r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7:nat) : Lemma
(requires
d10 == d8 / pow2 52 + sum7 /\
r0 = c3 % pow2 52 /\ c6 = c3 / pow2 52 + sum1 + d8 % pow2 52 * r /\
d11 = d10 / pow2 64 /\
r1 = c6 % pow2 52 /\ c9 = c6 / pow2 52 + sum2 + r * (d10 % pow2 64) /\
r2 = c9 % pow2 52 /\ c11 = c9 / pow2 52 + r * pow2 12 * d11 + t3 /\
r3 = c11 % pow2 52 /\ r4 = c11 / pow2 52 + (d4 % pow2 52) % pow2 48)
(ensures
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208 =
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + (d4 % pow2 48) * pow2 208)
let lemma_nat_r43210 r0 r1 r2 r3 r4 c3 c6 c9 c11 d4 d8 d10 d11 t3 r sum1 sum2 sum7 =
let k = d4 % pow2 48 in
let tmp1 = sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156 in
calc (==) { // tmp1 * pow2 52
(sum2 * pow2 52 + t3 * pow2 104 + k * pow2 156) * pow2 52;
(==) { ML.lemma_distr_pow (sum2 * pow2 52 + t3 * pow2 104) k 156 52 }
(sum2 * pow2 52 + t3 * pow2 104) * pow2 52 + k * pow2 208;
(==) { ML.lemma_distr_pow_pow sum2 52 t3 104 52 }
sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208;
};
calc (==) {
r0 + r1 * pow52 + r2 * pow104 + r3 * pow156 + r4 * pow208;
(==) { ML.lemma_as_nat_horner r0 r1 r2 r3 r4 }
(((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0;
(==) { lemma_nat_r4321 r1 r2 r3 r4 c6 c9 c11 d4 d10 d11 t3 r sum2 }
(c3 / pow2 52 + sum1 + d8 % pow2 52 * r + r * (d8 / pow2 52 + sum7) * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r d8 sum7 (pow2 52) }
(c3 / pow2 52 + sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52 + c3 % pow2 52;
(==) { ML.lemma_distr_eucl c3 (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) }
c3 + (sum1 + r * d8 + r * sum7 * pow2 52 + tmp1) * pow2 52;
(==) { ML.lemma_distr_pow (sum1 + r * d8 + tmp1) (r * sum7) 52 52 }
c3 + (sum1 + r * d8 + tmp1) * pow2 52 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left (sum1 + r * d8) tmp1 (pow2 52) }
c3 + (sum1 + r * d8) * pow2 52 + sum2 * pow2 104 + t3 * pow2 156 + k * pow2 208 + r * sum7 * pow2 104;
(==) { Math.Lemmas.distributivity_add_left sum2 (r * sum7) (pow2 104) }
c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 + t3 * pow2 156 + k * pow2 208;
}
val simplify_c3 (d4 r sum5:nat) : Lemma
(requires r % pow2 4 = 0)
(ensures (let k = (d4 / pow2 52 + sum5) % pow2 52 in
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4) ==
(d4 / pow2 48) * (r / pow2 4) + (k - (d4 / pow2 52)) * r))
let simplify_c3 d4 r sum5 =
let k = (d4 / pow2 52 + sum5) % pow2 52 in
calc (==) { //simplify c3
((d4 % pow2 52) / pow2 48 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.pow2_modulo_division_lemma_1 d4 48 52 }
((d4 / pow2 48) % pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.euclidean_division_definition (d4 / pow2 48) (pow2 4) }
(d4 / pow2 48 - (d4 / pow2 48 / pow2 4) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.division_multiplication_lemma d4 (pow2 48) (pow2 4); Math.Lemmas.pow2_plus 48 4 }
(d4 / pow2 48 - (d4 / pow2 52) * pow2 4 + k * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_sub_left k (d4 / pow2 52) (pow2 4) }
(d4 / pow2 48 + (k - d4 / pow2 52) * pow2 4) * (r / pow2 4);
(==) { Math.Lemmas.distributivity_add_left (d4 / pow2 48) ((k - d4 / pow2 52) * pow2 4) (r / pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * pow2 4 * (r / pow2 4);
(==) { Math.Lemmas.paren_mul_right (k - d4 / pow2 52) (pow2 4) (r / pow2 4); Math.Lemmas.div_exact_r r (pow2 4) }
(d4 / pow2 48) * (r / pow2 4) + (k - d4 / pow2 52) * r;
}
val lemma_nat_r43210_mod_prime (c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8: nat) : Lemma
(requires
r = 0x1000003D10 /\
d4 = (sum3 + r * (sum8 % pow2 64)) / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64) /\
t3 = (sum3 + r * (sum8 % pow2 64)) % pow2 52 /\
d8 = (d4 / pow2 52 + sum5) / pow2 52 + sum6 /\
c3 = sum0 + ((d4 % pow2 52) / pow2 48 + ((d4 / pow2 52 + sum5) % pow2 52) * pow2 4) * (r / pow2 4))
(ensures
(c3 + (sum1 + r * d8) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
t3 * pow2 156 + (d4 % pow2 48) * pow2 208) % S.prime ==
(sum0 + sum5 * r + (sum1 + sum6 * r) * pow2 52 + (sum2 + r * sum7) * pow2 104 +
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208) % S.prime)
let lemma_nat_r43210_mod_prime c3 d4 d8 t3 r sum0 sum1 sum2 sum3 sum4 sum5 sum6 sum7 sum8 =
let tmp2 = sum3 + r * (sum8 % pow2 64) in
let tmp1 = d4 / pow2 52 + sum5 in
let tmp0 = sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r in
let d4mod = (d4 % pow2 48) * pow2 208 + (d4 / pow2 48) * 0x1000003D1 in
calc (==) {
c3 + (d4 % pow2 48) * pow2 208 + (sum1 + r * d8) * pow2 52;
(==) { simplify_c3 d4 r sum5; assert_norm (0x1000003D10 / pow2 4 = 0x1000003D1) }
d4mod + tmp0 + (sum1 + r * d8) * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * d8) (pow2 52) }
d4mod + sum0 + (tmp1 % pow2 52 - d4 / pow2 52) * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { Math.Lemmas.distributivity_sub_left (tmp1 % pow2 52) (d4 / pow2 52) r }
d4mod + sum0 + (tmp1 % pow2 52) * r - d4 / pow2 52 * r + sum1 * pow2 52 + r * (tmp1 / pow2 52 + sum6) * pow2 52;
(==) { ML.lemma_distr_eucl_mul_add r tmp1 sum6 (pow2 52) }
d4mod + sum0 + r * (d4 / pow2 52 + sum5) - d4 / pow2 52 * r + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_right r (d4 / pow2 52) sum5 }
d4mod + sum0 + r * sum5 + sum1 * pow2 52 + r * sum6 * pow2 52;
(==) { Math.Lemmas.distributivity_add_left sum1 (r * sum6) (pow2 52) }
d4mod + sum0 + r * sum5 + (sum1 + r * sum6) * pow2 52;
};
calc (==) { //t3 * pow2 156 + d4 * pow2 208;
(tmp2 % pow2 52) * pow2 156 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 208;
(==) { ML.lemma_distr_pow (tmp2 % pow2 52) (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) 52 156 }
(tmp2 % pow2 52 + (tmp2 / pow2 52 + sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_eucl_mul_add 1 tmp2 (sum4 + r * pow2 12 * (sum8 / pow2 64)) (pow2 52) }
(tmp2 + (sum4 + r * pow2 12 * (sum8 / pow2 64)) * pow2 52) * pow2 156;
(==) { ML.lemma_swap_mul3 r (pow2 12) (sum8 / pow2 64) }
(tmp2 + (sum4 + r * (sum8 / pow2 64) * pow2 12) * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow sum4 (r * (sum8 / pow2 64)) 12 52 }
(sum3 + r * (sum8 % pow2 64) + sum4 * pow2 52 + r * (sum8 / pow2 64) * pow2 64) * pow2 156;
(==) { ML.lemma_distr_eucl_mul r sum8 (pow2 64) }
(sum3 + r * sum8 + sum4 * pow2 52) * pow2 156;
(==) { ML.lemma_distr_pow (sum3 + r * sum8) sum4 52 156 }
(sum3 + r * sum8) * pow2 156 + sum4 * pow2 208;
};
LD.as_nat_mod_prime (sum0 + r * sum5) (sum1 + r * sum6) (sum2 + r * sum7) t3 d4
val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156)) | false | false | Hacl.Spec.K256.Field52.Lemmas4.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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :
Lemma
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *
(b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =
sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +
pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156)) | [] | Hacl.Spec.K256.Field52.Lemmas4.lemma_mul_ab | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Lemmas4.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a0: Prims.nat ->
a1: Prims.nat ->
a2: Prims.nat ->
a3: Prims.nat ->
a4: Prims.nat ->
b0: Prims.nat ->
b1: Prims.nat ->
b2: Prims.nat ->
b3: Prims.nat ->
b4: Prims.nat
-> FStar.Pervasives.Lemma
(ensures
(let sum0 = a0 * b0 in
let sum1 = a0 * b1 + a1 * b0 in
let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in
let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in
let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in
let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in
let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in
let sum7 = a3 * b4 + a4 * b3 in
let sum8 = a4 * b4 in
(a0 + a1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
a2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
a3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
a4 * Hacl.Spec.K256.Field52.Definitions.pow208) *
(b0 + b1 * Hacl.Spec.K256.Field52.Definitions.pow52 +
b2 * Hacl.Spec.K256.Field52.Definitions.pow104 +
b3 * Hacl.Spec.K256.Field52.Definitions.pow156 +
b4 * Hacl.Spec.K256.Field52.Definitions.pow208) =
sum0 + sum1 * Prims.pow2 52 + sum2 * Prims.pow2 104 + sum3 * Prims.pow2 156 +
sum4 * Prims.pow2 208 +
Prims.pow2 260 *
(sum5 + sum6 * Prims.pow2 52 + sum7 * Prims.pow2 104 + sum8 * Prims.pow2 156))) | {
"end_col": 5,
"end_line": 294,
"start_col": 48,
"start_line": 215
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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 lift_state_all (a:Type) (wp:st_wp a) (p:all_post a) = wp (fun a -> p (V a)) | let lift_state_all (a: Type) (wp: st_wp a) (p: all_post a) = | false | null | false | wp (fun a -> p (V a)) | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.HyperStack.ST.st_wp",
"FStar.HyperStack.All.all_post",
"FStar.Pervasives.V",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_True",
"FStar.Pervasives.st_pre_h"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST
let all_pre = all_pre_h HyperStack.mem
let all_post' (a:Type) (pre:Type) = all_post_h' HyperStack.mem a pre
let all_post (a:Type) = all_post_h HyperStack.mem a
let all_wp (a:Type) = all_wp_h HyperStack.mem a
new_effect ALL = ALL_h HyperStack.mem | false | false | FStar.HyperStack.All.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 lift_state_all : a: Type -> wp: FStar.HyperStack.ST.st_wp a -> p: FStar.HyperStack.All.all_post a
-> FStar.Pervasives.st_pre_h FStar.Monotonic.HyperStack.mem | [] | FStar.HyperStack.All.lift_state_all | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> wp: FStar.HyperStack.ST.st_wp a -> p: FStar.HyperStack.All.all_post a
-> FStar.Pervasives.st_pre_h FStar.Monotonic.HyperStack.mem | {
"end_col": 87,
"end_line": 25,
"start_col": 66,
"start_line": 25
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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_wp (a:Type) = all_wp_h HyperStack.mem a | let all_wp (a: Type) = | false | null | false | all_wp_h HyperStack.mem a | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.Pervasives.all_wp_h",
"FStar.Monotonic.HyperStack.mem"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST
let all_pre = all_pre_h HyperStack.mem
let all_post' (a:Type) (pre:Type) = all_post_h' HyperStack.mem a pre | false | true | FStar.HyperStack.All.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 all_wp : a: Type -> Type | [] | FStar.HyperStack.All.all_wp | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> Type | {
"end_col": 47,
"end_line": 22,
"start_col": 22,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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_pre = all_pre_h HyperStack.mem | let all_pre = | false | null | false | all_pre_h HyperStack.mem | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.Pervasives.all_pre_h",
"FStar.Monotonic.HyperStack.mem"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST | false | true | FStar.HyperStack.All.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 all_pre : Type | [] | FStar.HyperStack.All.all_pre | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Type | {
"end_col": 38,
"end_line": 19,
"start_col": 14,
"start_line": 19
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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_post' (a:Type) (pre:Type) = all_post_h' HyperStack.mem a pre | let all_post' (a pre: Type) = | false | null | false | all_post_h' HyperStack.mem a pre | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.Pervasives.all_post_h'",
"FStar.Monotonic.HyperStack.mem"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST | false | true | FStar.HyperStack.All.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 all_post' : a: Type -> pre: Type -> Type | [] | FStar.HyperStack.All.all_post' | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> pre: Type -> Type | {
"end_col": 68,
"end_line": 20,
"start_col": 36,
"start_line": 20
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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_post (a:Type) = all_post_h HyperStack.mem a | let all_post (a: Type) = | false | null | false | all_post_h HyperStack.mem a | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.Pervasives.all_post_h",
"FStar.Monotonic.HyperStack.mem"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST
let all_pre = all_pre_h HyperStack.mem | false | true | FStar.HyperStack.All.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 all_post : a: Type -> Type | [] | FStar.HyperStack.All.all_post | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> Type | {
"end_col": 52,
"end_line": 21,
"start_col": 25,
"start_line": 21
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": 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 lift_exn_all (a:Type) (wp:ex_wp a) (p:all_post a) (h:HyperStack.mem) = wp (fun ra -> p ra h) | let lift_exn_all (a: Type) (wp: ex_wp a) (p: all_post a) (h: HyperStack.mem) = | false | null | false | wp (fun ra -> p ra h) | {
"checked_file": "FStar.HyperStack.All.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "FStar.HyperStack.All.fst"
} | [
"total"
] | [
"FStar.Pervasives.ex_wp",
"FStar.HyperStack.All.all_post",
"FStar.Monotonic.HyperStack.mem",
"FStar.Pervasives.result",
"Prims.l_True",
"FStar.Pervasives.ex_pre"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.HyperStack.All
include FStar.HyperStack.ST
let all_pre = all_pre_h HyperStack.mem
let all_post' (a:Type) (pre:Type) = all_post_h' HyperStack.mem a pre
let all_post (a:Type) = all_post_h HyperStack.mem a
let all_wp (a:Type) = all_wp_h HyperStack.mem a
new_effect ALL = ALL_h HyperStack.mem
unfold let lift_state_all (a:Type) (wp:st_wp a) (p:all_post a) = wp (fun a -> p (V a))
sub_effect STATE ~> ALL = lift_state_all | false | false | FStar.HyperStack.All.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 lift_exn_all : a: Type ->
wp: FStar.Pervasives.ex_wp a ->
p: FStar.HyperStack.All.all_post a ->
h: FStar.Monotonic.HyperStack.mem
-> FStar.Pervasives.ex_pre | [] | FStar.HyperStack.All.lift_exn_all | {
"file_name": "ulib/FStar.HyperStack.All.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} |
a: Type ->
wp: FStar.Pervasives.ex_wp a ->
p: FStar.HyperStack.All.all_post a ->
h: FStar.Monotonic.HyperStack.mem
-> FStar.Pervasives.ex_pre | {
"end_col": 105,
"end_line": 28,
"start_col": 84,
"start_line": 28
} |
|
Prims.GTot | val addr_of (#a: Type0) (arr: array a) : GTot nat | [
{
"abbrev": false,
"full_module": "FStar.Ref",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let addr_of (#a:Type0) (arr:array a) : GTot nat = addr_of (as_ref arr) | val addr_of (#a: Type0) (arr: array a) : GTot nat
let addr_of (#a: Type0) (arr: array a) : GTot nat = | false | null | false | addr_of (as_ref arr) | {
"checked_file": "FStar.Array.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Ref.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Array.fsti"
} | [
"sometrivial"
] | [
"FStar.Array.array",
"FStar.Ref.addr_of",
"FStar.Seq.Base.seq",
"FStar.Array.as_ref",
"Prims.nat"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Array
(**
F* standard library mutable arrays module.
@summary Mutable arrays
*)
open FStar.All
open FStar.Seq
open FStar.Ref
#set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0"
val array (a:Type0) : Type0
val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))
let sel (#a:Type0) (h:heap) (s:array a) : GTot (seq a) = Heap.sel h (as_ref s)
let contains (#a:Type0) (h:heap) (s:array a) : Type0 = Heap.contains h (as_ref s)
let unused_in (#a:Type0) (arr:array a) (h:heap) : Type0 = Heap.unused_in (as_ref arr) h
let heap_upd (#a:Type0) (h:heap) (r:array a) (v:seq a) : GTot heap = Heap.upd h (as_ref r) v | false | false | FStar.Array.fsti | {
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val addr_of (#a: Type0) (arr: array a) : GTot nat | [] | FStar.Array.addr_of | {
"file_name": "ulib/legacy/FStar.Array.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | arr: FStar.Array.array a -> Prims.GTot Prims.nat | {
"end_col": 70,
"end_line": 43,
"start_col": 50,
"start_line": 43
} |
Prims.Tot | val unused_in (#a: Type0) (arr: array a) (h: heap) : Type0 | [
{
"abbrev": false,
"full_module": "FStar.Ref",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let unused_in (#a:Type0) (arr:array a) (h:heap) : Type0 = Heap.unused_in (as_ref arr) h | val unused_in (#a: Type0) (arr: array a) (h: heap) : Type0
let unused_in (#a: Type0) (arr: array a) (h: heap) : Type0 = | false | null | false | Heap.unused_in (as_ref arr) h | {
"checked_file": "FStar.Array.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Ref.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Array.fsti"
} | [
"total"
] | [
"FStar.Array.array",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.Heap.unused_in",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"FStar.Array.as_ref"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Array
(**
F* standard library mutable arrays module.
@summary Mutable arrays
*)
open FStar.All
open FStar.Seq
open FStar.Ref
#set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0"
val array (a:Type0) : Type0
val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))
let sel (#a:Type0) (h:heap) (s:array a) : GTot (seq a) = Heap.sel h (as_ref s)
let contains (#a:Type0) (h:heap) (s:array a) : Type0 = Heap.contains h (as_ref s) | false | false | FStar.Array.fsti | {
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val unused_in (#a: Type0) (arr: array a) (h: heap) : Type0 | [] | FStar.Array.unused_in | {
"file_name": "ulib/legacy/FStar.Array.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | arr: FStar.Array.array a -> h: FStar.Monotonic.Heap.heap -> Type0 | {
"end_col": 87,
"end_line": 39,
"start_col": 58,
"start_line": 39
} |
Prims.Tot | val contains (#a: Type0) (h: heap) (s: array a) : Type0 | [
{
"abbrev": false,
"full_module": "FStar.Ref",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let contains (#a:Type0) (h:heap) (s:array a) : Type0 = Heap.contains h (as_ref s) | val contains (#a: Type0) (h: heap) (s: array a) : Type0
let contains (#a: Type0) (h: heap) (s: array a) : Type0 = | false | null | false | Heap.contains h (as_ref s) | {
"checked_file": "FStar.Array.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Ref.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Array.fsti"
} | [
"total"
] | [
"FStar.Monotonic.Heap.heap",
"FStar.Array.array",
"FStar.Monotonic.Heap.contains",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"FStar.Array.as_ref"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Array
(**
F* standard library mutable arrays module.
@summary Mutable arrays
*)
open FStar.All
open FStar.Seq
open FStar.Ref
#set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0"
val array (a:Type0) : Type0
val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))
let sel (#a:Type0) (h:heap) (s:array a) : GTot (seq a) = Heap.sel h (as_ref s) | false | false | FStar.Array.fsti | {
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val contains (#a: Type0) (h: heap) (s: array a) : Type0 | [] | FStar.Array.contains | {
"file_name": "ulib/legacy/FStar.Array.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | h: FStar.Monotonic.Heap.heap -> s: FStar.Array.array a -> Type0 | {
"end_col": 81,
"end_line": 37,
"start_col": 55,
"start_line": 37
} |
Subsets and Splits